<?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=Urbana</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=Urbana"/>
	<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/Special:Contributions/Urbana"/>
	<updated>2026-08-12T11:23:20Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Further_solutions_provided_by_LimeSurvey_users&amp;diff=57923</id>
		<title>Workarounds: Further solutions provided by LimeSurvey users</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Further_solutions_provided_by_LimeSurvey_users&amp;diff=57923"/>
		<updated>2013-10-19T17:14:02Z</updated>

		<summary type="html">&lt;p&gt;Urbana: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Here you can find workarounds/solutions provided by LimeSurvey users which do &#039;&#039;&#039;not&#039;&#039;&#039; deal with these workaround sections:&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
* [[Workarounds: Manipulating a survey at runtime using Javascript|Manipulating a survey at runtime using Javascript]]&lt;br /&gt;
* [[Workarounds: Survey behaviour|Survey behaviour]].&lt;br /&gt;
&lt;br /&gt;
If you are looking for &#039;&#039;&#039;general troubleshooting&#039;&#039;&#039; please check our [[General FAQ|General FAQ]] and [[Installation FAQ|Installation FAQ]]. If you can&#039;t find a solution for your problem please [http://www.limesurvey.org/en/forum open a new thread at our forum] or ask at our [http://www.limesurvey.org/en/community-services/live-chat live chat].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&#039;&#039;&#039;Please keep in mind that the workarounds published here are no official LimeSurvey extensions but solutions that other users created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore we can&#039;t give support for any solution on this page.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;Please contact the users that, thankfully, shared their solutions with the community if you have any questions.&#039;&#039;&#039;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to import survey responses from v1.00 into v1.5x (and later)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LS &amp;gt;= 1.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In LimeSurvey v1.50 it&amp;amp;acute;s possible to import a survey, which is generated (and exported) with v1.00 into v1.5x. The Problem is, on that way only the survey structure gets imported, but no respones to that survey.&lt;br /&gt;
&lt;br /&gt;
If you also need to import the responses, follow the next steps:&lt;br /&gt;
#Export your survey in v1.00&lt;br /&gt;
#Do a VV-Export in v1.00 (to save your responses)&lt;br /&gt;
#Import your survey from v1.00 into v1.5x via &amp;quot;Create or Import a New Survey&amp;quot; in the main Admin Panel&lt;br /&gt;
#Activate your imported survey&lt;br /&gt;
#Fill out your survey once, so that at least one response is in your database.&lt;br /&gt;
#Do a VV-Export in v1.5x&lt;br /&gt;
#Open both VV-Exports (v1.5x and v1.00); if you use Microsoft Excel do it via &amp;quot;Open New File&amp;quot; and &amp;quot;Import from Text-File&amp;quot; or &amp;quot;Import from external source - textfile&amp;quot; and choose &amp;quot;seperated&amp;quot; and &amp;quot;Unicode (UTF-8)&amp;quot;; choose&lt;br /&gt;
#Compare the file structure and you&amp;amp;acute;ll see that there are two columns added (submitdate and startlanguage) and that all question codes changed.&lt;br /&gt;
#Copy all rows (except row 1 and 2, that means you start with the third row) from your VV-Export  v1.00 into your VV-Export v1.5x (also put it at the third row)&lt;br /&gt;
#Add the columns &amp;quot;submitdate&amp;quot; and &amp;quot;startlanguage&amp;quot; in your VV-Export v1.5x-File, right between &amp;quot;id&amp;quot; and &amp;quot;token&amp;quot;&lt;br /&gt;
#Save your file (in Microsoft Excel use Textfile - Tabstopp seperated). It&amp;amp;acute;s necessary that your file after saving has the same format as before - Notice: it&amp;amp;acute;s not a normal .csv-File.&lt;br /&gt;
#Import your file via VV-Import&lt;br /&gt;
&lt;br /&gt;
=Translate surveys without admin access=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
User &amp;quot;CasN&amp;quot; has written a nice extension that allows you to translate surveys without having access to the admin panel. He has added his files in the bug and feature tracker ([http://bugs.limesurvey.org/view.php?id=1735 01735: Remote translating feature]) where you can download them. You&#039;ll also find a short How-To there.&lt;br /&gt;
&lt;br /&gt;
This is how it works:&lt;br /&gt;
&lt;br /&gt;
Copy the scripts in the root of your survey directory and call starttrans.php like this starttrans.php?survey=12345&lt;br /&gt;
&lt;br /&gt;
It will check the languages connected to the survey and also verify the labelsets used.&lt;br /&gt;
&lt;br /&gt;
You will then get a screen with for each language the required links for translating, aswell for the labels as the survey itself. From the survey, the question and tip fields are presented for translation.&lt;br /&gt;
&lt;br /&gt;
Thanks CasN for sharing your solution with the community!&lt;br /&gt;
&lt;br /&gt;
=Create Question Pools=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a simple solution to create question pools for LimeSurvey. It will require access to the backend database. I&#039;m not going to explain how to do this, as &#039;&#039;&#039;&#039;&#039;if you don&#039;t understand it, then you shouldn&#039;t really do it&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Basically 3 tables exist that we care about:&lt;br /&gt;
*lime_surveys - id field = sid&lt;br /&gt;
*lime_groups - id field = gid&lt;br /&gt;
*lime_questions id field = qid&lt;br /&gt;
&lt;br /&gt;
In order to show the questions correctly the id field from the &#039;&#039;lime_groups &#039;&#039;table exists in the &#039;&#039;lime_questions &#039;&#039;table. This then is used to create the parent/child relationship.&lt;br /&gt;
&lt;br /&gt;
However, if you want to create a pool of questions all you need to do is to amend the gid field in the &#039;&#039;lime_questions&#039;&#039; table to a value that doesn&#039;t exist in the &#039;&#039;lime_groups &#039;&#039;table. I would use 0 or a something silly like 10000. Try this with one question and you will notice it doesnt appear in the question list.&lt;br /&gt;
&lt;br /&gt;
It&#039;s a crude workaround, but allows you to create as many questions as you want, without having them visible.&lt;br /&gt;
&lt;br /&gt;
This could also be applied for groups as well just by using the sid field in the &#039;&#039;lime_groups &#039;&#039;table.&lt;br /&gt;
&lt;br /&gt;
=Re-open a submitted answer=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.71+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As an administrator you can re-open a submitted answer.&lt;br /&gt;
# Reset tokens invitation to not sent&lt;br /&gt;
# Reset answers to not completed&lt;br /&gt;
## &#039;&#039;&#039;release &amp;lt;= 1.72&#039;&#039;&#039;: In LS &amp;lt;= 1.72 you don&#039;t have the option to &amp;quot;Reset answers to not completed&amp;quot; that version 1.8 offers, so this would require the following workaround:&lt;br /&gt;
### export of tokens&lt;br /&gt;
### vvexport of answers&lt;br /&gt;
### deactivate/activate survey in order to erase answers&lt;br /&gt;
### import answers from VVimport but Add the &#039;import as not finalized answers&#039; option&lt;br /&gt;
### import tokens&lt;br /&gt;
## &#039;&#039;&#039;release &amp;gt;= 1.8&#039;&#039;&#039;:&lt;br /&gt;
### from the answer summary page, a new option can be used to reset all answers to a not submitted state&lt;br /&gt;
### from the tokens summary page, you can reset all tokens to &#039;not sent&#039; state&lt;br /&gt;
&lt;br /&gt;
Note that this &#039;&#039;&#039;&#039;&#039;will work only on non anonymous surveys with &amp;quot;Allow Persistence&amp;quot; option set&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Bypassing email check at registration=&lt;br /&gt;
&lt;br /&gt;
When you allow public registration to your survey LimeSurvey developers have opted to put in place a certain level of protection from bots and spammers by placing a captcha and by forcing the users to go and check their emails to find the link associated with their tokens.&lt;br /&gt;
&lt;br /&gt;
Sometimes, however, this is a nuisance that actually force people to wait for the email when they would rather just take the survey and get on with things. Ideally it would be great if a token-based survey present the participant a short-text box (like a security question) asking at random one of the field in the registration form when the token is passed via URL (i will put this as feature request for the next edition!).&lt;br /&gt;
&lt;br /&gt;
In the meantime, there is a very easy workaround. The solution is to edit the register.php and add the following code around line 156 (where the code is rewriting the page with the message that the email has been sent):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a href=&#039;$publicurl/index.php?sid=$surveyid&amp;amp;token;=$newtoken&amp;amp;lang;=$baselang&#039;&amp;gt;Whatever you want to say&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I placed right on line 156 between the two line breaks. The code is simply creating a link to the survey embedding the token in the URL.&lt;br /&gt;
&lt;br /&gt;
NOTE that this is literally bypassing the safety currently in place, but the advantage is streamlining the steps for taking the survey with registration.&lt;br /&gt;
&lt;br /&gt;
=Alternate Bypassing Email Check at Registration=&lt;br /&gt;
&lt;br /&gt;
For version 1.87, please add the following code on line 180 above the //PRINT COMPLETED PAGE in register.php.  This will take the user directly to the welcome page without any pauses in between and bypasses the user having to go to the email validation to start the survey.&lt;br /&gt;
&lt;br /&gt;
header(&amp;quot;Location: $publicurl/index.php?sid=$surveyid&amp;amp;token;=$newtoken&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
- Zad Imam 04/20/2010&lt;br /&gt;
&lt;br /&gt;
=Used email and public registration=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with v1.8&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When you have a closed survey with public registration, currently LimeSurvey is not allowing a user to re-use the same email. This is a problem if the user has deleted the registration email without taking the survey. In the above workaround a user was allowed to take a survey by presenting a link straight after the registration; ideally they should be prompted with an additional security question and/or captcha (see bugtracker). In the meantime, this owrkaround allows you to from a link from the corresponding email and present it to the user.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure you back up your register.php first!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here the querystring has been modified to pull out the token as well as the email address and the error message has been changed to display the link to the survey for the existing token. &#039;&#039;&#039;Please also note that this forced change will not be reflected in the different languages!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Around line 75 find the corresponding 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;
//Check if this email already exists in token database&lt;br /&gt;
&lt;br /&gt;
$query = &amp;quot;SELECT email,token FROM {$dbprefix}tokens_$surveyid\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
. &amp;quot;WHERE email = &amp;quot;.db_quoteall(sanitize_email[[&#039;register_email&#039;]]);&lt;br /&gt;
&lt;br /&gt;
$result = $connect-&amp;gt;Execute($query) or safe_die ($query.&amp;quot;&amp;lt;br /&amp;gt;&amp;quot;.$connect-&amp;gt;ErrorMsg());   //Checked&lt;br /&gt;
&lt;br /&gt;
if [[$result-&amp;gt;RecordCount(]] &amp;gt; 0)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   //transform in array of values&lt;br /&gt;
&lt;br /&gt;
   $row=$result-&amp;gt;FetchRow();&lt;br /&gt;
&lt;br /&gt;
   $register_errormsg=$clang-&amp;gt;gT(&amp;quot;The email you used has already been registered.&amp;quot;).&amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
   &amp;quot;&amp;lt;a style=&#039;color:red;font-weight: bold;&#039; href=&#039;$publicurl/index.php?sid=$surveyid&amp;amp;token;&lt;br /&gt;
&lt;br /&gt;
       = &amp;quot;.$row[&#039;token&#039;].&amp;quot;&amp;amp;lang;=$baselang&#039;&amp;gt;Click this link to take the survey now&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   include &amp;quot;index.php&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   exit;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=HTTP-Refferer is not shown after a Redirect=&lt;br /&gt;
&lt;br /&gt;
There are different ways to redirect a page, just as HTTP-Redirect 301, meta http-equiv=&amp;quot;Refresh&amp;quot;, meta http-equiv=&amp;quot;Referrer&amp;quot;, link rel=&amp;quot;canonical&amp;quot; or JavaScript window.location. But all of them don&#039;t work correct in all Browsers when it comes up to the HTTP-Referer. The only working solution I found is with a bit strange JavaScript. You see the solution at [http://www.visionen.ch/umfrage/redirect.pdf]&lt;br /&gt;
&lt;br /&gt;
=Provide a preview-all-questions page for any survey=&lt;br /&gt;
&lt;br /&gt;
Sometimes people would like to be able to preview all questions in a survey before actually &#039;&#039;taking &#039;&#039;the survey - it gives them a chance to prepare their information in advance. While the LimeSurvey admin tool lets you create a printable version of a survey, this is not really appropriate for end users, as it contains placeholders for token values, etc. So, for our installation I created a separate PHP script, which you can install on your server and provide for users. Further notes are in the body of the script:&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;
/******&lt;br /&gt;
&lt;br /&gt;
PreviewLimeSurvey.php&lt;br /&gt;
&lt;br /&gt;
Displays an HTML page with a preview of all questions in the specified survey; multiple-choice and array questions are displayed with all possible responses listed out. Mandatory questions are displayed with &amp;quot;(* REQUIRED)&amp;quot; after the question text.&lt;br /&gt;
&lt;br /&gt;
Usage: Pass the 5-digit survey ID, e.g.: http://{some_path}/PreviewLimeSurvey.php?sid=nnnnn&lt;br /&gt;
&lt;br /&gt;
Preparation:&lt;br /&gt;
&lt;br /&gt;
   - In the calls to mysql_connect() and mysql_select_db(), substitute the parameters for your own LimeSurvey server and database&lt;br /&gt;
&lt;br /&gt;
   - In the HTML part, modify styles and page title as desired&lt;br /&gt;
&lt;br /&gt;
   - This code presumes your LimeSurvey database tables use standard nomenclature: lime_questions, lime_answers, etc. If that is NOT the case, you will need to modify table names in the queries.&lt;br /&gt;
&lt;br /&gt;
CAVEATS:&lt;br /&gt;
&lt;br /&gt;
   - This does not handle ALL LimeSurvey question types. The default behavior is to print just the text of each question. It then adds additional info for specific types that include lists of options, array tables, etc., but you may need to modify the code to handle all the types that you use.&lt;br /&gt;
&lt;br /&gt;
   - It does NOT print boilerplate questions (type &#039;X&#039;), because in our setup these would be irrelevant when someone just wants to preview the survey questions. You can change this by commenting out the clause &amp;quot;if ($row[&#039;type&#039;] != &#039;X&#039;)&amp;quot;&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// Put the page parameters in globals&lt;br /&gt;
&lt;br /&gt;
$mySID = $_GET[&#039;sid&#039;];&lt;br /&gt;
&lt;br /&gt;
// Preview questions and possible responses for the specified survey ID&lt;br /&gt;
&lt;br /&gt;
function preview_survey($sid) {&lt;br /&gt;
&lt;br /&gt;
   $dbh = mysql_connect(&#039;myHost&#039;, &#039;myLimeSurveyDatabaseUsername&#039;, &#039;myLimeSurveyDatabasePassword&#039;);&lt;br /&gt;
&lt;br /&gt;
   mysql_select_db(&#039;myLimeSurveyDatabaseName&#039;, $dbh);&lt;br /&gt;
&lt;br /&gt;
   // Start by getting survey name from db, to display in title&lt;br /&gt;
&lt;br /&gt;
   $result = mysql_query(&amp;quot;SELECT surveyls_title FROM lime_surveys_languagesettings WHERE surveyls_survey_id={$sid}&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   $row = mysql_fetch_assoc($result);&lt;br /&gt;
&lt;br /&gt;
   $output = &amp;quot;&amp;lt;h2&amp;gt;Survey Preview: {$row[&#039;surveyls_title&#039;]}&amp;lt;/h2&amp;gt;&amp;quot;;    // Initialize markup with heading showing survey name&lt;br /&gt;
&lt;br /&gt;
   $output .= &#039;&amp;lt;div style=&amp;quot;margin:15px 0 15px 1em;width:30em;&amp;quot;&amp;gt;Below are questions that will appear on your survey.&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
   $result = mysql_query(&amp;quot;SELECT lq.qid, lq.sid, lq.gid, lq.lid, lq.type, lq.title, lq.question, lq.mandatory, lg.group_order FROM lime_questions AS lq, lime_groups AS lg WHERE lq.sid=&#039;{$sid}&#039; AND lg.sid=lq.sid AND lq.gid=lg.gid ORDER BY lg.group_order ASC, question_order ASC&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   while ($row = mysql_fetch_assoc($result))&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
       // For all questions *except* Boilerplate (type X), print out the main question text&lt;br /&gt;
&lt;br /&gt;
       if ($row[&#039;type&#039;] != &#039;X&#039;) {&lt;br /&gt;
&lt;br /&gt;
           if ($row[&#039;mandatory&#039;] == &#039;Y&#039;)&lt;br /&gt;
&lt;br /&gt;
               $isMandatory = &#039; &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;(* REQUIRED)&amp;lt;/span&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
           else&lt;br /&gt;
&lt;br /&gt;
               $isMandatory = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Grab the question text and put in a &amp;lt;div&amp;gt;, first filtering it thru stripFinalBrk(); this strips out the final break tag that appears&lt;br /&gt;
&lt;br /&gt;
           // in many of the questions, which can mess up our formatting (break tags INSIDE the question text are left alone)&lt;br /&gt;
&lt;br /&gt;
           $output .= &#039;&amp;lt;div class=&amp;quot;qText&amp;quot;&amp;gt;&#039; . stripFinalBrk($row[&#039;question&#039;]) . $isMandatory . &#039;&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Get array of possible options: This will be empty for some question types&lt;br /&gt;
&lt;br /&gt;
           $qOpts = mysql_query(&amp;quot;SELECT answer FROM lime_answers WHERE qid={$row[&#039;qid&#039;]} ORDER BY code ASC&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
           $numOpts = mysql_num_rows($qOpts);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       switch ($row[&#039;type&#039;]) {        // Process output based on question type&lt;br /&gt;
&lt;br /&gt;
           case &#039;Q&#039;:    // Multiple short text&lt;br /&gt;
&lt;br /&gt;
           case &#039;P&#039;:&lt;br /&gt;
&lt;br /&gt;
           case &#039;K&#039;:&lt;br /&gt;
&lt;br /&gt;
           case &#039;L&#039;:&lt;br /&gt;
&lt;br /&gt;
               $output .= &#039;&amp;lt;ul style=&amp;quot;margin:0;&amp;quot;&amp;gt;&#039;;    // Begin tag for bulleted list of options&lt;br /&gt;
&lt;br /&gt;
               // Populate an array of options listed for this question&lt;br /&gt;
&lt;br /&gt;
               while ($rowOpts = mysql_fetch_assoc($qOpts))&lt;br /&gt;
&lt;br /&gt;
                   $output .= &#039;&amp;lt;li&amp;gt;&#039; . $rowOpts[&#039;answer&#039;] . &#039;&amp;lt;/li&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
               $output .= &#039;&amp;lt;/ul&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
               break;&lt;br /&gt;
&lt;br /&gt;
           case &#039;;&#039;:        // Mandatory multi-choice flex labels (tabular display)&lt;br /&gt;
&lt;br /&gt;
               $output .= &#039;&amp;lt;div style=&amp;quot;margin-left:2em;&amp;quot;&amp;gt;&amp;lt;table border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;4&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Get labels for columns and create top table row for output&lt;br /&gt;
&lt;br /&gt;
               $output .= &amp;quot;&amp;lt;th&amp;gt; &amp;lt;/th&amp;gt;&amp;quot;;    // 1st column where row labels will go&lt;br /&gt;
&lt;br /&gt;
               $qColumns = mysql_query(&amp;quot;SELECT title FROM lime_labels WHERE lid={$row[&#039;lid&#039;]} ORDER BY sortorder ASC&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
               $numColumns = mysql_num_rows($qColumns);&lt;br /&gt;
&lt;br /&gt;
               while ($colOpts = mysql_fetch_assoc($qColumns)) {&lt;br /&gt;
&lt;br /&gt;
                   $output .= &amp;quot;&amp;lt;th&amp;gt;{$colOpts[&#039;title&#039;]}&amp;lt;/th&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
               $output .= &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
               //  Create one row per option. The row labels will be the $qOpts we already got. Use these for 1st column, fill others with blanks&lt;br /&gt;
&lt;br /&gt;
               while ($rowOpts = mysql_fetch_assoc($qOpts)) {&lt;br /&gt;
&lt;br /&gt;
                   $output .= &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;{$rowOpts[&#039;answer&#039;]}&amp;lt;/td&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   for ($i=0; $i &amp;lt; $numColumns; $i++) {    // Fill in blank columns under the column heads output above&lt;br /&gt;
&lt;br /&gt;
                       $output .= &amp;quot;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                       }    // end $i&lt;br /&gt;
&lt;br /&gt;
                   $output .= &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   }    // end while ($rowOpts)&lt;br /&gt;
&lt;br /&gt;
               $output .= &amp;quot;&amp;lt;/table&amp;gt;&amp;lt;/div&amp;gt;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
               break;&lt;br /&gt;
&lt;br /&gt;
           case &#039;Z&#039;;    // Flexible drop-down/radio-button - user selections come from lime_labels; here, show all possible options&lt;br /&gt;
&lt;br /&gt;
               $output .= &#039;&amp;lt;ul style=&amp;quot;margin:0;&amp;quot;&amp;gt;&#039;;    // Begin tag for bulleted list of options&lt;br /&gt;
&lt;br /&gt;
               $qLabels = mysql_query(&amp;quot;SELECT title FROM lime_labels WHERE lid={$row[&#039;lid&#039;]}&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
               while ($rowOpts = mysql_fetch_assoc($qLabels)) {&lt;br /&gt;
&lt;br /&gt;
                   $output .= &#039;&amp;lt;li&amp;gt;&#039; . $rowOpts[&#039;title&#039;] . &#039;&amp;lt;/li&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
               $output .= &#039;&amp;lt;/ul&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
               break;&lt;br /&gt;
&lt;br /&gt;
           default:    // For any type not specified above, no further output after displaying the question text&lt;br /&gt;
&lt;br /&gt;
               break;&lt;br /&gt;
&lt;br /&gt;
           }    // END: switch ($row[&#039;type&#039;])&lt;br /&gt;
&lt;br /&gt;
       }    // End main loop thru survey questions (while ($row....)&lt;br /&gt;
&lt;br /&gt;
   return ($output);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/******&lt;br /&gt;
&lt;br /&gt;
   stripFinalBrk(): Test if string ends with a &amp;lt;br /&amp;gt; tag, and if so remove it; returns modified string.&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
function stripFinalBrk($myString) {&lt;br /&gt;
&lt;br /&gt;
   $yerString = strrev($myString);    // Reverse input string for testing&lt;br /&gt;
&lt;br /&gt;
   // Check if *reversed* string begins with a &amp;lt;br /&amp;gt; tag (backwards) - if so, strip out starting characters and return the rest&lt;br /&gt;
&lt;br /&gt;
   if (substr($yerString,0,6) == &#039;&amp;gt;/ rb&amp;lt;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $yerString = substr($yerString,6);&lt;br /&gt;
&lt;br /&gt;
   return(strrev($yerString));    // Reverse back for result&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;title&amp;gt;LimeSurvey Preview Page&amp;lt;/title&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;style&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       body {&lt;br /&gt;
&lt;br /&gt;
           font-family: Helvetica, Verdana, sans-serif;&lt;br /&gt;
&lt;br /&gt;
           padding:1em 0 2em 1em;&lt;br /&gt;
&lt;br /&gt;
           font-size:0.9em;&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       td, th {&lt;br /&gt;
&lt;br /&gt;
           font-size:0.8em;&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       li {&lt;br /&gt;
&lt;br /&gt;
           font-size:0.9em;&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       h2 {&lt;br /&gt;
&lt;br /&gt;
           color:#00A;&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       div.qText {&lt;br /&gt;
&lt;br /&gt;
           margin:1em 0 0.5em 0;&lt;br /&gt;
&lt;br /&gt;
           padding:0.5em 0 0.2em 0;&lt;br /&gt;
&lt;br /&gt;
           border-top: solid 1px #00a;&lt;br /&gt;
&lt;br /&gt;
           /* border-bottom: solid 1px #00a; */&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;/style&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;?php echo(preview_survey($mySID)); ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;hr style=&amp;quot;margin-top:15px;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to export a clean up-to-date .doc questionnaire directly from LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Once we have programmed a questionnaire we sometimes need to export it back. For example, we have made some changes directly in the interface, and would like to save them in a human-readable way for reference. Or, maybe our client needs to make some changes in the plain old .doc format.&lt;br /&gt;
&lt;br /&gt;
While LS lacks such a function it is still possible to do this with free software and a little effort.&lt;br /&gt;
&lt;br /&gt;
Step 1: go to the printable version of your questionnaire&lt;br /&gt;
&lt;br /&gt;
http://img401.imageshack.us/img401/1535/e7e788d275844deeb207679.png&lt;br /&gt;
&lt;br /&gt;
Step 2: using your browser save the html file of the questionnaire locally.&lt;br /&gt;
&lt;br /&gt;
Step 3: open the file &#039;&#039;using Libre Office&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Step 4: save/export the document as .doc.&lt;br /&gt;
&lt;br /&gt;
Step 5: beautify the result. In your word processor of choice you may want to align all text to the left and use some automated way to put a border on your tables (use this http://www.thedoctools.com/index.php?show=mt_tableborder if you have MsWord)&lt;br /&gt;
&lt;br /&gt;
That&#039;s it. Now you have a file that can be sent to your clients or edited.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For &#039;&#039;&#039;step 2&#039;&#039;&#039;, you may actually want to consider exporting to PDF by using a PDF printer as Bullzip PDF or CutePDF. Your partners may use one of the many PDF annotation tools to comment. On the plus side, it will look a bit better, keeping checkboxes and stuff.&lt;br /&gt;
&lt;br /&gt;
However, not all people are comfortable using this. Even more importantly, I have found that when it exports questionnaire logic in human-readable form the text becomes hard to follow or even stops making sense.&lt;br /&gt;
&lt;br /&gt;
For &#039;&#039;&#039;step 3&#039;&#039;&#039; you can, theoretically, use other tools like Word or OpenOffice. However the matrix-intensive survey I used for testing crashed all software except LO. Depending on the questionnaire you may need to take other decisions.&lt;br /&gt;
&lt;br /&gt;
=Notepad++ macro to replace . with;=&lt;br /&gt;
&lt;br /&gt;
If you try to paste a list like this&lt;br /&gt;
&lt;br /&gt;
1. option1&lt;br /&gt;
&lt;br /&gt;
2. option2&lt;br /&gt;
&lt;br /&gt;
... into the quick add box in LimeSurvey it will likely not wok out nicely because it will keep the numbering in the label of the option. However if you change it to ...&lt;br /&gt;
&lt;br /&gt;
1; option1&lt;br /&gt;
&lt;br /&gt;
2; option2&lt;br /&gt;
&lt;br /&gt;
... it will work just fine, creating both codes and labels. I have created a Notepad++ macro that replaces the . following numbers up to 30 with ; , provided that all numbers are at the beginning of the line.&lt;br /&gt;
&lt;br /&gt;
To install it you must&lt;br /&gt;
&lt;br /&gt;
1. Close Notepad++ and keep it closed (otherwise it will override your work)&lt;br /&gt;
&lt;br /&gt;
2. Search for shortcuts.xml in the program folder&lt;br /&gt;
&lt;br /&gt;
3. Open it with another text editor&lt;br /&gt;
&lt;br /&gt;
4. In the macro section paste the code below.&lt;br /&gt;
&lt;br /&gt;
Note that N++ does not have something like an &amp;quot;echo off&amp;quot; command, so you will get lots of feedback from the program while the macro runs. However, I have created several smaller macros so that you may want to choose based on how wide your numbers range. (It will all come clear once you actually run the macro)&lt;br /&gt;
&lt;br /&gt;
Now 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;  &amp;lt;Macro name=&amp;quot;format.1to5&amp;quot; Ctrl=&amp;quot;no&amp;quot; Alt=&amp;quot;no&amp;quot; Shift=&amp;quot;no&amp;quot; Key=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;Action type=&amp;quot;0&amp;quot; message=&amp;quot;2316&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n1.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n1;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n2.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n2;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n3.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n3;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n4.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n4;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n5.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n5;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;/Macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;Macro name=&amp;quot;format.1to10&amp;quot; Ctrl=&amp;quot;no&amp;quot; Alt=&amp;quot;no&amp;quot; Shift=&amp;quot;no&amp;quot; Key=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;0&amp;quot; message=&amp;quot;2316&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n1.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n1;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n2.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n2;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n3.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n3;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n4.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n4;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n5.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n5;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n6.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n6;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n7.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n7;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n8.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n8;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n9.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n9;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n10.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n10;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;/Macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;Macro name=&amp;quot;format.11to20&amp;quot; Ctrl=&amp;quot;no&amp;quot; Alt=&amp;quot;no&amp;quot; Shift=&amp;quot;no&amp;quot; Key=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;0&amp;quot; message=&amp;quot;2316&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n11.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n11;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n12.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n12;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n13.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n13;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n14.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n14;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n15.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n15;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n16.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n16;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n17.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n17;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n18.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n18;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n19.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n19;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n20.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n20;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;/Macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;Macro name=&amp;quot;format.21to30&amp;quot; Ctrl=&amp;quot;no&amp;quot; Alt=&amp;quot;no&amp;quot; Shift=&amp;quot;no&amp;quot; Key=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;0&amp;quot; message=&amp;quot;2316&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n21.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n21;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n22.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n22;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n23.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n23;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n24.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n24;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n25.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n25;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n26.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n26;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n27.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n27;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n28.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n28;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n29.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n29;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1700&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1601&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n30.&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1625&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1602&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;\n30;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1702&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;512&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;3&amp;quot; message=&amp;quot;1701&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;1609&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;/Macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;Macro name=&amp;quot;home&amp;quot; Ctrl=&amp;quot;no&amp;quot; Alt=&amp;quot;no&amp;quot; Shift=&amp;quot;no&amp;quot; Key=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &amp;lt;Action type=&amp;quot;0&amp;quot; message=&amp;quot;2316&amp;quot; wParam=&amp;quot;0&amp;quot; lParam=&amp;quot;0&amp;quot; sParam=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;/Macro&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Procedure to translate all surveys in the desired language quick and easy=&lt;br /&gt;
&lt;br /&gt;
Step 1: Setup LimeSurvey&lt;br /&gt;
&lt;br /&gt;
#	Install all new fonts in the Computer/ Server&lt;br /&gt;
#	Add language folders in ~\htdocs\locale&lt;br /&gt;
#	Go to ~\htdocs\application\helpers and insert commands for the desired languages in SurveyRuntimeHelper.php&lt;br /&gt;
#	Go to ~\ htdocs\third_party\ckeditor\_source\plugins\font and edit Plugin.js file using notepad++. Press ctrl+f and                                        search for ‘verdana’. Add all the fonts that you have installed in step A.&lt;br /&gt;
#	Go to ~\htdocs\third_party\ckeditor and edit ckeditor.js file using notepad++. Press ctrl+f and search for ‘verdana’. Add all the fonts that you have installed in step A.&lt;br /&gt;
&lt;br /&gt;
Note: Step 1 is to be performed only once. You can skip this step for all subsequent projects.&lt;br /&gt;
&lt;br /&gt;
Step 2: Export Survey&lt;br /&gt;
&lt;br /&gt;
#	Export your Survey in .txt (UTF-8 format).&lt;br /&gt;
#	Open the .txt file in excel.&lt;br /&gt;
&lt;br /&gt;
Step 3: Import Translations&lt;br /&gt;
&lt;br /&gt;
#	Look for the language code in the .txt file. Copy all ‘en’ entries of the questions (with their respective answer options) on a new excel sheet.&lt;br /&gt;
#	Now open the translated excel sheet shared by the client and perform vlookup. Check for errors and incomplete translations.&lt;br /&gt;
#	Once all translations are done, copy the translated entries and paste them in automated translations.xlsx sheet.&lt;br /&gt;
#	Final step. Now, copy the output generated from the automated translations.xlsx sheet and paste it in the .txt file.&lt;br /&gt;
&lt;br /&gt;
Step 4: Save and Upload&lt;br /&gt;
&lt;br /&gt;
#	Save the .txt file in the same format i.e. Tab Delimited.&lt;br /&gt;
#	Now open LimeSurvey and Import the survey.&lt;br /&gt;
&lt;br /&gt;
=Provide a basic statistic without the need of an user account (for example to provide a stat for your client)=&lt;br /&gt;
&lt;br /&gt;
This PHP script shows the number of the participants of surveys and the development of the participations presented with a Google Line Chart.&lt;br /&gt;
There are three key-features:&lt;br /&gt;
1. The necessary survey ID&#039;s and the title of the project are provide with GET variables so anyone can set up the statistic without the need to adapt the source code&lt;br /&gt;
2. The client can see the development with the help of Google Charts&lt;br /&gt;
3. Real time count of the overall number of participants&lt;br /&gt;
&lt;br /&gt;
Further the script can handle also surveys where the dates weren&#039;t logged and the surveys can also be mixed.&lt;br /&gt;
&lt;br /&gt;
All you need is to provide a URL following this pattern&lt;br /&gt;
http://yourdomain/survey_stat.php?survey=1010101,2020202,3030303&amp;amp;title=Client%20Name&lt;br /&gt;
&lt;br /&gt;
survey=&lt;br /&gt;
Here you provide the survey ID&#039;s from one or different surveys (when the client runs more than one survey or you want to compare different surveys)&lt;br /&gt;
title =&lt;br /&gt;
Here you provide the title&lt;br /&gt;
&lt;br /&gt;
That&#039;s it.&lt;br /&gt;
It is pretty easy and can be set up from anyone.&lt;br /&gt;
&lt;br /&gt;
Here is the full script ready to go with google JS and HTML 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;
&amp;lt;?php&lt;br /&gt;
 &lt;br /&gt;
//Connect to the database you use for limesurvey&lt;br /&gt;
try {&lt;br /&gt;
    $db = new PDO(&#039;mysql:host=yourhost.com;dbname=lime_db&#039;, &#039;user&#039;, &#039;pass&#039;);&lt;br /&gt;
} catch (PDOException $e) {&lt;br /&gt;
    print &amp;quot;Error!: &amp;quot; . $e-&amp;gt;getMessage() . &amp;quot;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
    die();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
function participants_pd($sid, $db) {&lt;br /&gt;
	//get the number of participants for each day of the survey&lt;br /&gt;
	$facts = array();&lt;br /&gt;
	$x = 0;&lt;br /&gt;
	if(!is_numeric($sid)) {&lt;br /&gt;
		echo &amp;quot;Survery ID must be a valid number&amp;quot;;&lt;br /&gt;
		exit();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$survey_tbl = &amp;quot;lime_survey_&amp;quot;.$sid;&lt;br /&gt;
		$query = &amp;quot;select date(`submitdate`) AS date, count(`id`) AS number from `$survey_tbl` where `submitdate` != &#039;NULL&#039; group by date(`submitdate`)&amp;quot;;&lt;br /&gt;
		$stmt = $db-&amp;gt;query($query);&lt;br /&gt;
		while($r = $stmt-&amp;gt;fetch(PDO::FETCH_OBJ)) {&lt;br /&gt;
				$facts[&#039;date&#039;][$x] = $r-&amp;gt;date;&lt;br /&gt;
				$facts[&#039;count&#039;][$x] = $r-&amp;gt;number;&lt;br /&gt;
				$x++;&lt;br /&gt;
		}&lt;br /&gt;
		$db = null;&lt;br /&gt;
		return $facts;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
function participants_sum($sid, $db) {&lt;br /&gt;
	//get number of participants of the survey&lt;br /&gt;
	if(!is_numeric($sid)) {&lt;br /&gt;
		echo &amp;quot;Survery ID must be a valid number&amp;quot;;&lt;br /&gt;
		exit();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
	$survey_tbl = &amp;quot;lime_survey_&amp;quot;.$sid;&lt;br /&gt;
	$sum = &amp;quot;&amp;quot;;&lt;br /&gt;
	$survey_tbl = &amp;quot;lime_survey_&amp;quot;.$sid;&lt;br /&gt;
	$query = &amp;quot;select count(`id`) AS sum from `$survey_tbl` where `submitdate` != &#039;NULL&#039;&amp;quot;;&lt;br /&gt;
	$stmt = $db-&amp;gt;query($query);&lt;br /&gt;
	$r = $stmt-&amp;gt;fetch(PDO::FETCH_OBJ);&lt;br /&gt;
	$sum = $r-&amp;gt;sum;&lt;br /&gt;
	return $sum;	&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
function titles($sid, $db) {&lt;br /&gt;
	//get the titles&lt;br /&gt;
	$title = &amp;quot;&amp;quot;;&lt;br /&gt;
	$query_t = &amp;quot;select `surveyls_title` from `lime_surveys_languagesettings` where `surveyls_survey_id` = :sid&amp;quot;;&lt;br /&gt;
	$stmt_t = $db-&amp;gt;prepare($query_t);&lt;br /&gt;
	$stmt_t-&amp;gt;bindParam(&#039;:sid&#039;, $sid);&lt;br /&gt;
	$stmt_t-&amp;gt;execute();&lt;br /&gt;
	$r = $stmt_t-&amp;gt;fetch(PDO::FETCH_OBJ);&lt;br /&gt;
	$title = $r-&amp;gt;surveyls_title;&lt;br /&gt;
	return $title;	&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Getting the ID&#039;s of the surveys&lt;br /&gt;
if(isset($_GET[&#039;survey&#039;])) {&lt;br /&gt;
	$titles = array();&lt;br /&gt;
	$participants = array();&lt;br /&gt;
	$surveys = array();&lt;br /&gt;
	//check if there are more then one surveys-ids&lt;br /&gt;
	if(preg_match(&amp;quot;/,/&amp;quot;, $_GET[&#039;survey&#039;])) {&lt;br /&gt;
		//there are more then one survey &lt;br /&gt;
		$surveys = explode(&amp;quot;,&amp;quot;, $_GET[&#039;survey&#039;]);&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$surveys[] = $_GET[&#039;survey&#039;];&lt;br /&gt;
	}&lt;br /&gt;
	foreach ($surveys as $key =&amp;gt; $value) {&lt;br /&gt;
		//Get the number of participants for each day of the survey of each survey&lt;br /&gt;
		$arrayname = &amp;quot;survey&amp;quot;.$value;&lt;br /&gt;
		${$arrayname} = participants_pd($value,$db);&lt;br /&gt;
 &lt;br /&gt;
		//Get number of participants for the whole periode&lt;br /&gt;
		$participants[] = participants_sum($value,$db);&lt;br /&gt;
 &lt;br /&gt;
		//Get the titles of the surveys&lt;br /&gt;
		$titles[] = titles($value,$db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* generating the data string for the google chart&lt;br /&gt;
* Will look something like that:&lt;br /&gt;
* [&#039;Day&#039;,&#039;Title S1&#039;,&#039;Title S2&#039;,&#039;Title S3&#039;],&lt;br /&gt;
* [&#039;2013-10-08&#039;,35,462,101],&lt;br /&gt;
* [&#039;2013-10-09&#039;,15,101,33],&lt;br /&gt;
* [&#039;2013-10-10&#039;,7,37,10],&lt;br /&gt;
* [&#039;2013-10-11&#039;,5,14,1],&lt;br /&gt;
* [&#039;2013-10-13&#039;,2,10,1]]);&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//First the column names of the chart (in our case Day and the titles )&lt;br /&gt;
$data = &amp;quot;[&#039;Day&#039;&amp;quot;;&lt;br /&gt;
foreach ($titles as $key =&amp;gt; $value) {&lt;br /&gt;
	$data = $data.&amp;quot;,&#039;&amp;quot;.$value.&amp;quot;&#039;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
$data = $data.&amp;quot;]&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Check which survey the most days&lt;br /&gt;
//The x-axis of the chart will filled with the dates of this survey&lt;br /&gt;
$max = 0;&lt;br /&gt;
$max_sid = &amp;quot;&amp;quot;;&lt;br /&gt;
foreach ($surveys as $key =&amp;gt; $value) {&lt;br /&gt;
	$arrayname = &amp;quot;survey&amp;quot;.$value;&lt;br /&gt;
	if($max &amp;lt; count(${$arrayname}[&#039;date&#039;])){&lt;br /&gt;
		$max = count(${$arrayname}[&#039;date&#039;]);&lt;br /&gt;
		$max_sid = $key;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//fill in the numbers of participants &lt;br /&gt;
$x = 0;&lt;br /&gt;
while ($x &amp;lt; $max) {&lt;br /&gt;
	$data = $data.&amp;quot;,[&#039;&amp;quot;.${&amp;quot;survey&amp;quot;.$surveys[$max_sid]}[&#039;date&#039;][$x].&amp;quot;&#039;&amp;quot;;&lt;br /&gt;
	foreach ($surveys as $key =&amp;gt; $value) {&lt;br /&gt;
		$arrayname = &amp;quot;survey&amp;quot;.$value;&lt;br /&gt;
		if(!empty(${$arrayname}[&#039;count&#039;][$x])) {&lt;br /&gt;
		$data = $data.&amp;quot;,&amp;quot;.${$arrayname}[&#039;count&#039;][$x];&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$data = $data.&amp;quot;,0&amp;quot;;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	$data = $data.&amp;quot;]&amp;quot;;&lt;br /&gt;
	$x++;&lt;br /&gt;
}&lt;br /&gt;
//$data contains now a string with the JS Data Array &lt;br /&gt;
//&amp;lt;?=$data has to be placed in the JS containing the google chart function&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//Setting the title of the site (can be the name of the project or of the costumer)&lt;br /&gt;
$title = &amp;quot;Development of the numbers of participants &amp;quot;;&lt;br /&gt;
if(isset($_GET[&#039;title&#039;])) {&lt;br /&gt;
	trim($_GET[&#039;title&#039;]);&lt;br /&gt;
	htmlentities($_GET[&#039;title&#039;]);&lt;br /&gt;
	$title = $title.$_GET[&#039;title&#039;];&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;meta charset=&amp;quot;UTF-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
	&amp;lt;title&amp;gt;&amp;lt;?=$title?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
	&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;&lt;br /&gt;
	body,html {&lt;br /&gt;
		font-family: Droid Sans;&lt;br /&gt;
		font-size: 13px;&lt;br /&gt;
		margin:0px;&lt;br /&gt;
		width: 100%;&lt;br /&gt;
		height: 100%;&lt;br /&gt;
		background-color: grey;&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	h1 {&lt;br /&gt;
		font-size: 18px;&lt;br /&gt;
		background-color: white;&lt;br /&gt;
		margin-left: 0px;&lt;br /&gt;
		width: 50%;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
	}&lt;br /&gt;
	h2 {&lt;br /&gt;
		font-size: 15px;&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	.stat {&lt;br /&gt;
		width: 50%;&lt;br /&gt;
		background-color: white;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
	}&lt;br /&gt;
	.stat_li {&lt;br /&gt;
		width: 25%;&lt;br /&gt;
		float: left;&lt;br /&gt;
		text-align: right;&lt;br /&gt;
	}&lt;br /&gt;
	.stat_re {&lt;br /&gt;
		width: 45%;&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin-left: 5%;&lt;br /&gt;
		font-weight: bold;&lt;br /&gt;
	}&lt;br /&gt;
	&amp;lt;/style&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
  &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;https://www.google.com/jsapi&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
      //set up the chart&lt;br /&gt;
      //check out https://developers.google.com/chart/ for more options&lt;br /&gt;
      google.load(&amp;quot;visualization&amp;quot;, &amp;quot;1&amp;quot;, {packages:[&amp;quot;corechart&amp;quot;]});&lt;br /&gt;
      google.setOnLoadCallback(drawChart);&lt;br /&gt;
      &amp;lt;?php&lt;br /&gt;
      if(isset($_GET[&#039;survey&#039;])) {&lt;br /&gt;
      ?&amp;gt;&lt;br /&gt;
      function drawChart() {&lt;br /&gt;
 &lt;br /&gt;
        var data = google.visualization.arrayToDataTable([&lt;br /&gt;
          &amp;lt;?=$data?&amp;gt;&lt;br /&gt;
        ]);&lt;br /&gt;
 &lt;br /&gt;
        var options = {&lt;br /&gt;
 &lt;br /&gt;
        };&lt;br /&gt;
 &lt;br /&gt;
        var chart = new google.visualization.LineChart(document.getElementById(&#039;chart_div&#039;));&lt;br /&gt;
        chart.draw(data, options);&lt;br /&gt;
      }&lt;br /&gt;
      &amp;lt;?php&lt;br /&gt;
  		}&lt;br /&gt;
      ?&amp;gt;&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;&amp;lt;?=$title?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Overall participants&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;stat&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
if(isset($_GET[&#039;survey&#039;])) {&lt;br /&gt;
	$x = 0;&lt;br /&gt;
	foreach ($participants as $key =&amp;gt; $value) {&lt;br /&gt;
		echo &amp;quot;&amp;lt;div class=&#039;stat_li&#039;&amp;gt;&amp;quot;.$titles[$x].&amp;quot;:&amp;lt;/div&amp;gt;&amp;lt;div class=&#039;stat_re&#039;&amp;gt;&amp;quot;.$value.&amp;quot; Participants&amp;lt;/div&amp;gt;&amp;lt;div style=&#039;clear:both;&#039;&amp;gt;&amp;lt;/div&amp;gt;&amp;quot;;&lt;br /&gt;
		$x++;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Development of the participation&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;chart_div&amp;quot; style=&amp;quot;width: 51%; height: 50%;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Urbana</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=57722</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=57722"/>
		<updated>2013-10-16T08:12:06Z</updated>

		<summary type="html">&lt;p&gt;Urbana: &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:  Version 1.92 implements many new features that make some existing workarounds obsolete.  You can continue to use existing workarounds, but may want to consider switching over to using the new features (since those new features are officially supported, and the workarounds are not).  Please review below for details of which are no longer needed.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also Note:  Version 1.92&#039;s 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, 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.gif]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:editor_2.gif]]&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;
&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;
It is a good practice to use the jQuery $(document).ready function to prevent the code from executing until the page is fully loaded:&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;
       alert(&amp;quot;Test!&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;
It is also good practice to use jslint.com to get a good layout and design (e.q. no cluttering of name space)&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;
=Skipping the welcome page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85 (second code snippet)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note: As of version 1.91, there is a survey option letting you skip the welcome page, so this workaround is not needed.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Solution 1:&#039;&#039;&#039; Include this Javascript in your welcome template, in the file welcome.pstpl for all welcome page, or in the source of the welcome text for one survey:&lt;br /&gt;
&lt;br /&gt;
&amp;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(function($) {&lt;br /&gt;
&lt;br /&gt;
document.limesurvey.move.value = &#039;movenext&#039;;&lt;br /&gt;
&lt;br /&gt;
document.limesurvey.submit(); });&lt;br /&gt;
&lt;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 reproduce the onclick event of the submit button and submit the form.&lt;br /&gt;
&lt;br /&gt;
Drawback of course is that users will see the page flashing up.&lt;br /&gt;
&lt;br /&gt;
Therefore, you may want to announce &amp;quot;... loading survey ...&amp;quot; as a description of your welcome page (in the admin interface when creating the survey), to pretend loading something big.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Solution 2:&#039;&#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;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function custom_on_load(){&lt;br /&gt;
&lt;br /&gt;
  document.limesurvey.move.value = &#039;movenext&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
window.setTimeout( &#039;custom_on_load()&#039;,1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&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;
&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;
&lt;br /&gt;
       $(&#039;select[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&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;
&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;
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;lt;/div&amp;gt;=&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;
=Reverse array_filter (for pre-1.90)=&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;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note: Version 1.91 natively supports this functionality via the array_filter_exclude advanced quation option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be used to filter the answers of an array question to be displayed based on the answers of a multi option question that were &#039;&#039;&#039;NOT&#039;&#039;&#039; selected. A possible application would be to have a multi-option question asking which products were purchased, followed by 2 array questions - one asking to rate the purchased products and another asking why the remaining products were not purchased. Another would be to ask about sessions attended at a conference as in [http://www.limesurvey.org/en/forum/5-can-i-do-this-with-limesurvey/27970-reverse-of-arrayfilter.html this forum thread] and pictured below. There is a live [http://www.partnersinc.biz/surveys//index.php?sid=43358&amp;amp;newtest=Y&amp;amp;lang=en demo here]&lt;br /&gt;
&lt;br /&gt;
[[File:sessions_645x344.gif]]&lt;br /&gt;
&lt;br /&gt;
We&#039;ll use the above example to explain the process as follows:&lt;br /&gt;
#In group 1 - Create a &#039;&#039;SessionsAttended&#039;&#039; multi-options question&lt;br /&gt;
#In group 1 - Create a &#039;&#039;SessionsNotAttended&#039;&#039; multi-options question with identical answers as &#039;&#039;SessionsAttended&#039;&#039; and hide it with styles or conditions&lt;br /&gt;
#In group 2 - Create a &#039;&#039;RateSessionsAttended&#039;&#039; array question with an [http://docs.limesurvey.org/tiki-index.php?page=Question+attributes&amp;amp;structure;=English+Instructions+for+LimeSurvey#array_filter array_filter] based on &#039;&#039;SessionsAttended&#039;&#039;&lt;br /&gt;
#In group 2 - Create a &#039;&#039;ReasonNotAttended&#039;&#039; array question with an [http://docs.limesurvey.org/tiki-index.php?page=Question+attributes&amp;amp;structure;=English+Instructions+for+LimeSurvey#array_filter array_filter] based on &#039;&#039;SessionsNotAttended&#039;&#039;&lt;br /&gt;
#In group 1 - Place JavaScript/jQeury listeners on each of the checkboxes in &#039;&#039;SessionsAttended&#039;&#039; that would toggle the corresponding checkbox in &#039;&#039;SessionsNotAttended&#039;&#039; to the opposite state&lt;br /&gt;
&lt;br /&gt;
The JavaScript/jQuery code used would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       // The toggle function&lt;br /&gt;
&lt;br /&gt;
   function toggle(q1, q2) {&lt;br /&gt;
&lt;br /&gt;
       if ($(q1).attr(&#039;checked&#039;) == false ) {&lt;br /&gt;
&lt;br /&gt;
           $(q2).attr(&#039;checked&#039;, true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       else {&lt;br /&gt;
&lt;br /&gt;
           $(q2).attr(&#039;checked&#039;, false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Initialize the SessionNotAttended checkboxes to &amp;quot;checked&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   toggle (&#039;#answer11111X22X331&#039;, &#039;#answer11111X22X441&#039;);&lt;br /&gt;
&lt;br /&gt;
   toggle (&#039;#answer11111X22X332&#039;, &#039;#answer11111X22X442&#039;);&lt;br /&gt;
&lt;br /&gt;
   toggle (&#039;#answer11111X22X333&#039;, &#039;#answer11111X22X443&#039;);&lt;br /&gt;
&lt;br /&gt;
   toggle (&#039;#answer11111X22X334&#039;, &#039;#answer11111X22X444&#039;);&lt;br /&gt;
&lt;br /&gt;
   // The jQuery listeners on the SessionAttended checkboxes&lt;br /&gt;
&lt;br /&gt;
   // that toggle the SessionNotAttended checkboxes&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#answer11111X22X331&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
       toggle (&#039;#answer11111X22X331&#039;, &#039;#answer11111X22X441&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#answer11111X22X332&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
       toggle (&#039;#answer11111X22X332&#039;, &#039;#answer11111X22X442&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#answer11111X22X333&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
       toggle (&#039;#answer11111X22X333&#039;, &#039;#answer11111X22X443&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#answer11111X22X334&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
       toggle (&#039;#answer11111X22X334&#039;, &#039;#answer11111X22X444&#039;);&lt;br /&gt;
&lt;br /&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 code is in an onload function defined in the first question of group 1 - see [[Workarounds#Custom_onload_function|here]]&lt;br /&gt;
*Both &#039;&#039;SessionsAttended&#039;&#039; and &#039;&#039;SessionsNotAttended&#039;&#039; must be in the same group for the toggling to work&lt;br /&gt;
*This case only uses 4 checkboxes but could be expanded as required&lt;br /&gt;
*In this case the survey ID is 11111, the group ID is 22, &#039;&#039;SessionsAttended&#039;&#039; ID is 33 and SessionsNotAttended ID is 44 - these would need to be modified for your survey&lt;br /&gt;
*The toggle function looks for the state of a checkbox in &#039;&#039;SessionsAttended&#039;&#039; and sets the corresponding checkbox in &#039;&#039;SessionsNotAttended&#039;&#039; to the opposite state&lt;br /&gt;
*The &amp;quot;Initialize&amp;quot; section sets the state of &#039;&#039;SessionsNotAttended&#039;&#039; checkboxes whenever we navigate to the group&lt;br /&gt;
*The &amp;quot;Listener&amp;quot; section uses jQuery listeners to detect any change in the &#039;&#039;SessionsAttended&#039;&#039; checkboxes and then toggle the corresponding &#039;&#039;SessionsNotAttended&#039;&#039; checkbox&lt;br /&gt;
&lt;br /&gt;
Some general notes about the questions:&lt;br /&gt;
*CSS can be used to hide &#039;&#039;SessionsNotAttended&#039;&#039; (div#question44 { display: none; }) if you don&#039;t want to use conditions (because maybe you&#039;ve got [[Optional settings#Survey Behavior|$deletenonvalues set to 1]])&lt;br /&gt;
*&#039;&#039;RateSessionsAttended&#039;&#039; and &#039;&#039;ReasonNotAttended&#039;&#039; are another group to avoid things popping in and out of existence as &#039;&#039;SessionsAttended&#039;&#039; is answered&lt;br /&gt;
*[[Setting conditions|Conditions]] are used to ensure that &#039;&#039;RateSessionsAttended&#039;&#039; only appears if some sessions are selected and &#039;&#039;ReasonNotAttended&#039;&#039; only appears if no sessions are selected&lt;br /&gt;
&lt;br /&gt;
=Filter Ranking Question With Multiple-Options (pre 1.92)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90, IE 7/8, FireFox 3/4, Safari 5.0, Chrome 10.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, most of this is easier to do using the the array_filter attribute, or relevance equations in general.  They all work on the same page, and fully support cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to a ranking question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and ranking questions being on the same page and a slightly different one for the filter question being on a page before the ranking question.&lt;br /&gt;
&lt;br /&gt;
There is a [http://www.partnersinc.biz/surveys//index.php?sid=96314&amp;amp;newtest=Y&amp;amp;lang=en demo of both methods here].&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;
*Place the following script in your template.js file. This function 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;
// A function to filter choices in a ranking question&lt;br /&gt;
function rankFilter(q1ID, q2ID, 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;+q1ID+&#039; li[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	handleChecked(q1ID, q2ID);&lt;br /&gt;
	$(&#039;#question&#039;+q1ID+&#039; input.checkbox&#039;).click(function() {&lt;br /&gt;
		handleChecked(q1ID, q2ID);&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	function handleChecked(q1ID, q2ID) {&lt;br /&gt;
	&lt;br /&gt;
		// Find the survey and group IDs&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;
			var gID = tmp[1];&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Loop through all Q1 options&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.checkbox&#039;).each(function(i) {&lt;br /&gt;
		&lt;br /&gt;
			// Find the answer code and value&lt;br /&gt;
			var tmp2 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+gID+&#039;X&#039;+q1ID+&#039;&#039;);&lt;br /&gt;
			var ansCode = tmp2[1];&lt;br /&gt;
			var ansTxt = $(this).next(&#039;label&#039;).text();&lt;br /&gt;
			&lt;br /&gt;
			// If option is checked and not in rank choices or output, add it to the rank choices&lt;br /&gt;
			if($(this).attr(&#039;checked&#039;) == true&lt;br /&gt;
						  &amp;amp;&amp;amp; $(&#039;#question&#039;+q2ID+&#039; select.select option[value=&amp;quot;&#039;+ansCode+&#039;&amp;quot;]&#039;).length == 0&lt;br /&gt;
						  &amp;amp;&amp;amp; $(&#039;#question&#039;+q2ID+&#039; .output input[id&amp;lt;/div&amp;gt;=&amp;quot;fvalue_&amp;quot;][value=&amp;quot;&#039;+ansCode+&#039;&amp;quot;]&#039;).length == 0) {&lt;br /&gt;
				$(&#039;&amp;lt;option value=&amp;quot;&#039;+ansCode+&#039;&amp;quot;&amp;gt;&#039;+ansTxt+&#039;&amp;lt;/option&amp;gt;&#039;).appendTo(&#039;#question&#039;+q2ID+&#039; select.select&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// If option is unchecked...&lt;br /&gt;
			else if($(this).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
				// Remove it from the rank choices&lt;br /&gt;
				$(&#039;#question&#039;+q2ID+&#039; select.select option[value=&amp;quot;&#039;+ansCode+&#039;&amp;quot;]&#039;).remove();&lt;br /&gt;
				// Remove it from the rank output and reset hidden values&lt;br /&gt;
$(&#039;#question&#039;+q2ID+&#039; .output input[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;fvalue_&amp;quot;][value=&amp;quot;&#039;+ansCode+&#039;&amp;quot;]&#039;).attr(&#039;value&#039;, &#039;&#039;).siblings(&#039;input.text&#039;).val(&#039;&#039;).siblings(&#039;img&#039;).hide();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Clean up empty inputs in the rank output table&lt;br /&gt;
		$(&#039;#question&#039;+q2ID+&#039; .output table tr&#039;).each(function(i) {&lt;br /&gt;
			var nextRow = $(this).next(&#039;tr&#039;);&lt;br /&gt;
			if($(&#039;input.text&#039;, this).val() == &#039;&#039; &amp;amp;&amp;amp; $(&#039;input.text&#039;, nextRow).val() != &#039;&#039;) {&lt;br /&gt;
				$(&#039;input.text&#039;, this).val($(&#039;input.text&#039;, nextRow).val());&lt;br /&gt;
				$(&#039;input.text&#039;, nextRow).val(&#039;&#039;);&lt;br /&gt;
				$(&#039;input[id&amp;lt;/div&amp;gt;=&amp;quot;fvalue_&amp;quot;]&#039;, this).attr(&#039;value&#039;, $(&#039;input[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;fvalue_&amp;quot;]&#039;, nextRow).attr(&#039;value&#039;));&lt;br /&gt;
				$(&#039;input[id&amp;lt;/div&amp;gt;=&amp;quot;fvalue_&amp;quot;]&#039;, nextRow).attr(&#039;value&#039;, &#039;&#039;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Show the scissors for the last populated rank output row&lt;br /&gt;
		$(&#039;#question&#039;+q2ID+&#039; .output table img[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;cut_&amp;quot;]&#039;).hide();&lt;br /&gt;
		$(&#039;#question&#039;+q2ID+&#039; .output table input.text[value!=&amp;quot;&amp;quot;]:last&#039;).siblings(&#039;img[id&amp;lt;/div&amp;gt;=&amp;quot;cut_&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Hide extra rank output rows&lt;br /&gt;
		var optNum = $(&#039;#question&#039;+q1ID+&#039; input.checkbox:checked&#039;).length;&lt;br /&gt;
		$(&#039;#question&#039;+q2ID+&#039; .output table tr&#039;).hide();&lt;br /&gt;
		$(&#039;#question&#039;+q2ID+&#039; .output table tr:lt(&#039;+(optNum+1)+&#039;)&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Hide and clear the ranking question if there are less than 2 checked options in Q1&lt;br /&gt;
		if(optNum &amp;lt; 2) {&lt;br /&gt;
			$(&#039;#question&#039;+q2ID+&#039;&#039;).hide();&lt;br /&gt;
			$(&#039;#question&#039;+q2ID+&#039; input.text&#039;).val(&#039;&#039;);&lt;br /&gt;
			$(&#039;#question&#039;+q2ID+&#039; input[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;fvalue_&amp;quot;]&#039;).attr(&#039;value&#039;, &#039;&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+q2ID+&#039;&#039;).show();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// A workaround for the built in max-answers function&lt;br /&gt;
		$(&#039;#question&#039;+q2ID+&#039; select.select&#039;).attr(&#039;disabled&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+q2ID+&#039; td.output tr:visible&#039;).each(function(i) {&lt;br /&gt;
			if($(&#039;input.text&#039;, this).val() == &#039;&#039;) {&lt;br /&gt;
				$(&#039;#question&#039;+q2ID+&#039; select.select&#039;).attr(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	// A listener to work around the built in max-answers function&lt;br /&gt;
	$(&#039;#question&#039;+q2ID+&#039; td.rank&#039;).click(function (event) {&lt;br /&gt;
		$(&#039;#question&#039;+q2ID+&#039; select.select&#039;).attr(&#039;disabled&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+q2ID+&#039; td.item input.text&#039;).each(function(i) {&lt;br /&gt;
			if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
				$(&#039;#question&#039;+q2ID+&#039; select.select&#039;).attr(&#039;disabled&#039;, false);&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 RANKING QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and a ranking 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;RR&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the ranking question unless at least two options are selected in the multiple options question, in which case, it will only show the options selected.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		rankFilter(MM, RR);&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 RANKING 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 a ranking 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;RR&amp;quot; with the ID of the ranking question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If at least 2 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 ranking question.&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;
	$(document).ready(function() {&lt;br /&gt;
		rankFilter(MM, RR, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&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;
&#039;&#039;Tested with: 1.91, IE 7/8, FireFox 3/4, Safari 5.0, Chrome 10.0&#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;
There is a [http://www.partnersinc.biz/surveys//index.php?sid=74213&amp;amp;newtest=Y&amp;amp;lang=en demo of both methods here].&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;
*Place the following scripts in your template.js file. These functions 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;lt;/div&amp;gt;=&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;
&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: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#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 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;
There is a small demo of the above example [http://www.partnersinc.biz/surveys//index.php?sid=81252&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Basically what we&#039;ve done here is to put listeners on all of the checkboxes. If a change of state is detected in any of them the &amp;quot;randomResponse&amp;quot; function is called which loops through all of the checkboxes and if it finds a checked state, that box&#039;s label is added to an array. Then a random item is pulled from the array and used to populate the hidden question. This hidden question can then be drawn upon later in the survey using [http://docs.limesurvey.org/tiki-index.php?page=Adding+a+Question#Information_from_previous_answers INSERTANS] or [http://docs.limesurvey.org/tiki-index.php?page=Setting+conditions&amp;amp;structure=English+Instructions+for+LimeSurvey Conditions].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo is as follows:&lt;br /&gt;
&lt;br /&gt;
#[http://docs.limesurvey.org/tiki-index.php?page=Workarounds%3A+Manipulating+a+survey+at+runtime+using+Javascript&amp;amp;structure=English+Instructions+for+LimeSurvey#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 that we&#039;re going to randomly pick a checked box from&lt;br /&gt;
#Create a text input question to store the label of the checked box in (we&#039;re going to hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of one of the questions on the page. &lt;br /&gt;
&lt;br /&gt;
The following edits are required to implement this in your survey:&lt;br /&gt;
&lt;br /&gt;
*EDIT HERE (1) - 11111 -&amp;gt; Survey ID, 22 -&amp;gt; Group ID, 44 -&amp;gt; hidden question ID.&lt;br /&gt;
*EDIT HERE (2) - 44 -&amp;gt; hidden question ID.&lt;br /&gt;
*EDIT HERE (3) - 11111 -&amp;gt; Survey ID, 22 -&amp;gt; Group ID, 33 -&amp;gt; multiple option question ID, A/B/C/D/E/F -&amp;gt; multiple option answer codes. Also add or remove CBs for more or less checkboxes.&lt;br /&gt;
*EDIT HERE (4) - add or remove CBs for more or less checkboxes.&lt;br /&gt;
*EDIT HERE (5) - add or remove CBs for more or less checkboxes. &lt;br /&gt;
&lt;br /&gt;
For more info on these IDs see [http://docs.limesurvey.org/tiki-index.php?page=SGQA+identifier&amp;amp;structure=English+Instructions+for+LimeSurvey SGQA identifier].&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;
		//// Identify the hidden question input&lt;br /&gt;
		//// EDIT HERE (1) - replace with your hidden question input ID&lt;br /&gt;
		var hiddenInput = &#039;#answer11111X22X44&#039;;&lt;br /&gt;
		&lt;br /&gt;
		//// Make the &amp;quot;hidden&amp;quot; question disappear&lt;br /&gt;
		//// EDIT HERE (2) - replace with your hidden question ID&lt;br /&gt;
		$(&#039;#question44&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		//// Identify the checkboxes to be randomized&lt;br /&gt;
		//// EDIT HERE (3) - add or remove as required, &lt;br /&gt;
		//// replace with your checkbox IDs&lt;br /&gt;
		var CB1 = &#039;#answer11111X22X33A&#039;;&lt;br /&gt;
		var CB2 = &#039;#answer11111X22X33B&#039;;&lt;br /&gt;
		var CB3 = &#039;#answer11111X22X33C&#039;;&lt;br /&gt;
		var CB4 = &#039;#answer11111X22X33D&#039;;&lt;br /&gt;
		var CB5 = &#039;#answer11111X22X33E&#039;;&lt;br /&gt;
		var CB6 = &#039;#answer11111X22X33F&#039;;&lt;br /&gt;
		&lt;br /&gt;
		//// Create an array of all checkboxes to be randomized&lt;br /&gt;
		//// EDIT HERE (4) - add or remove CBs as required&lt;br /&gt;
		checkBoxes = new Array( CB1, CB2, CB3, CB4, CB5, CB6 );&lt;br /&gt;
		var checkBoxesLength = checkBoxes.length;&lt;br /&gt;
		&lt;br /&gt;
		//// The randomizing function - no editing required&lt;br /&gt;
		function randomResponse () {&lt;br /&gt;
			var boxLabels = new Array();&lt;br /&gt;
			&lt;br /&gt;
			// loop through all of the checkboxes and if they are checked, &lt;br /&gt;
			// add their label to the boxLabels array&lt;br /&gt;
			for( var i=0; i&amp;lt;checkBoxesLength; i++ ) {&lt;br /&gt;
				if ( $(checkBoxes[i]).attr(&#039;checked&#039;) == true ) {&lt;br /&gt;
					var cbid = checkBoxes[i].replace(&#039;#&#039;,&#039;&#039;);&lt;br /&gt;
					boxLabels.push( $( &#039;label[for=&#039; + cbid + &#039;]&#039; ).html() );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// find a random index of the responses array&lt;br /&gt;
			var randomNum = Math.floor(Math.random() * boxLabels.length); &lt;br /&gt;
			&lt;br /&gt;
			// populate the hidden question input with the &lt;br /&gt;
			// random input value&lt;br /&gt;
			$(hiddenInput).val( boxLabels[randomNum] ); &lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		//// The listeners that will fire the randomize function if a &lt;br /&gt;
		//// change occurs in the checkboxes&lt;br /&gt;
		//// EDIT HERE (5) - add or remove CBs as required&lt;br /&gt;
		$(CB1).change(function() {&lt;br /&gt;
			randomResponse ();&lt;br /&gt;
		});&lt;br /&gt;
		$(CB2).change(function() {&lt;br /&gt;
			randomResponse ();&lt;br /&gt;
		});&lt;br /&gt;
		$(CB3).change(function() {&lt;br /&gt;
			randomResponse ();&lt;br /&gt;
		});&lt;br /&gt;
		$(CB4).change(function() {&lt;br /&gt;
			randomResponse ();&lt;br /&gt;
		});&lt;br /&gt;
		$(CB5).change(function() {&lt;br /&gt;
			randomResponse ();&lt;br /&gt;
		});&lt;br /&gt;
		$(CB6).change(function() {&lt;br /&gt;
			randomResponse ();&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;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&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 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.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is a small demo of the above example [http://www.partnersinc.biz/surveys//index.php?sid=11491&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
We&#039;ve put a listener on the primary answer (&amp;quot;Option 1&amp;quot; in the demo) that shows or hides the secondary answers depending on the state of the primary.&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo is as follows:&lt;br /&gt;
&lt;br /&gt;
#[http://docs.limesurvey.org/tiki-index.php?page=Workarounds%3A+Manipulating+a+survey+at+runtime+using+Javascript&amp;amp;structure=English+Instructions+for+LimeSurvey#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 answers (in the order that you would like them displayed if all shown)&lt;br /&gt;
#Add the following script to the source of the question.&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;&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		/**** &lt;br /&gt;
		The following code puts a listener on an answer in a multiple options&lt;br /&gt;
		question (the primary answer) and if that answer is checked, a secondary &lt;br /&gt;
		level of answers is displayed.&lt;br /&gt;
		****/&lt;br /&gt;
		&lt;br /&gt;
		// --- 1 --- Indent the secondary answers a bit&lt;br /&gt;
		$( &#039;#questionQQ li:eq(1)&#039; ).css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
		$( &#039;#questionQQ li:eq(2)&#039; ).css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
		&lt;br /&gt;
		// --- 2 --- When the page loads, see if the primary answer is checked and if not, &lt;br /&gt;
                //hide and un-check all secondary answers&lt;br /&gt;
		if ($( &#039;#answerSSSSSXGGXQQAA&#039; ).attr(&#039;checked&#039;) == false ) {&lt;br /&gt;
			&lt;br /&gt;
			$( &#039;#questionQQ li:eq(1)&#039; ).hide();&lt;br /&gt;
			$( &#039;#questionQQ li:eq(2)&#039; ).hide();&lt;br /&gt;
			&lt;br /&gt;
			$( &#039;#answerSSSSSXGGXQQBB&#039; ).attr(&#039;checked&#039;, false);&lt;br /&gt;
			$( &#039;#answerSSSSSXGGXQQCC&#039; ).attr(&#039;checked&#039;, false);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// --- 3 --- Now put a listener on the primary answer to show or hide secondary answers &lt;br /&gt;
		// We need to use .click instead of .change cause IE won&#039;t cooperate&lt;br /&gt;
		$(&#039;#answerSSSSSXGGXQQAA&#039;).click(function (event) {&lt;br /&gt;
			&lt;br /&gt;
			// Have a look at the primary answer and hide/show the secondary answers accordingly&lt;br /&gt;
			if ($( &#039;#answerSSSSSXGGXQQAA&#039; ).attr(&#039;checked&#039;) == false ) {&lt;br /&gt;
			&lt;br /&gt;
				$( &#039;#questionQQ li:eq(1)&#039; ).hide();&lt;br /&gt;
				$( &#039;#questionQQ li:eq(2)&#039; ).hide();&lt;br /&gt;
				&lt;br /&gt;
				$( &#039;#answerSSSSSXGGXQQBB&#039; ).attr(&#039;checked&#039;, false);&lt;br /&gt;
				$( &#039;#answerSSSSSXGGXQQCC&#039; ).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				&lt;br /&gt;
				$( &#039;#questionQQ li:eq(1)&#039; ).show();&lt;br /&gt;
				$( &#039;#questionQQ li:eq(2)&#039; ).show();&lt;br /&gt;
			} &lt;br /&gt;
			&lt;br /&gt;
			// The original functions of the click event&lt;br /&gt;
			cancelBubbleThis(event);&lt;br /&gt;
			checkconditions(this.value, this.name, this.type);&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;
&lt;br /&gt;
The following edits are required to implement this in your survey:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Section 1:&#039;&#039;&#039;&lt;br /&gt;
*This section indents the secondary answers to give the look of a list in a list when they&#039;re shown&lt;br /&gt;
*&#039;&#039;&#039;QQ&#039;&#039;&#039; is your question ID&lt;br /&gt;
*&#039;&#039;&#039;eq(1)&#039;&#039;&#039; and &#039;&#039;&#039;eq(2)&#039;&#039;&#039; are the index positions of your secondary options. Modify or add as necessary for the number and placement of secondary options in your question. Note that the index starts at 0 so &#039;&#039;&#039;eq(1)&#039;&#039;&#039; actually affects the second option in the full list and &#039;&#039;&#039;eq(2)&#039;&#039;&#039; affects the third. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Section 2:&#039;&#039;&#039;&lt;br /&gt;
*This section checks the state of the primary question when the page is loaded and if necessary hides the secondary questions. We need this in case users navigate away from and then back to the page.&lt;br /&gt;
*Modify &#039;&#039;&#039;eq(1)&#039;&#039;&#039; and &#039;&#039;&#039;eq(2)&#039;&#039;&#039; as above.&lt;br /&gt;
*&#039;&#039;&#039;SSSSS&#039;&#039;&#039; is your survey ID.&lt;br /&gt;
*&#039;&#039;&#039;GG&#039;&#039;&#039; is your group ID.&lt;br /&gt;
*&#039;&#039;&#039;QQ&#039;&#039;&#039; is your question ID.&lt;br /&gt;
*&#039;&#039;&#039;AA&#039;&#039;&#039; is your primary answer code.&lt;br /&gt;
*&#039;&#039;&#039;BB&#039;&#039;&#039; and &#039;&#039;&#039;CC&#039;&#039;&#039; are your secondary answer codes (add as necessary). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Section 3:&#039;&#039;&#039;&lt;br /&gt;
*This is the section that &amp;quot;listens&amp;quot; to the primary answer and reacts accordingly.&lt;br /&gt;
*Edit as in section 2.&lt;br /&gt;
&lt;br /&gt;
For more info on these IDs see SGQA identifier(external link).&lt;br /&gt;
&lt;br /&gt;
This code could be tidied up and shortened a bit but I left it this way to make it easier to follow.&lt;br /&gt;
&lt;br /&gt;
=Minimum number of required answers in an array (pre 1.92)=&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;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92 all array style questions have the min_answers and max_answers options, so this script is obsolete.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to specify a &#039;&#039;&#039;minimum number&#039;&#039;&#039; of answers required in an array question. It is an alternative to the &amp;quot;Mandatory&amp;quot; parameter which specifies that &#039;&#039;&#039;all&#039;&#039;&#039; answers are required. It could also be easily modified to specify a maximum number of answers.&lt;br /&gt;
&lt;br /&gt;
We accomplish this by placing an onload function in the source of the array question. This function hides the Next/Submit button and displays a warning element until it detects a minimum number of responses. It then hides the warning and shows the Next/Submit button.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=97166&amp;amp;newtest=Y&amp;amp;lang=en here].&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;
#Set up the template to use custom onload functions. (See the [[Workarounds#Custom onload function|workaround here]])&lt;br /&gt;
#In the source of the array 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;
#Modify the &#039;&#039;SETTINGS&#039;&#039; section of the code as required.&lt;br /&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;
	// Wait until the document is fully loaded&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		/********************** SETTINGS **********************/&lt;br /&gt;
		// The text to appear in the warning element&lt;br /&gt;
		var warningText = &#039;Please answer at least 4 to continue&#039;;&lt;br /&gt;
		// The question ID&lt;br /&gt;
		var questionId = 137;&lt;br /&gt;
		// The minimum number of answers required&lt;br /&gt;
		var minNumber = 4;&lt;br /&gt;
		/******************************************************/&lt;br /&gt;
		&lt;br /&gt;
		// Create the warning element and place it after the submit button&lt;br /&gt;
		var el = document.createElement(&#039;div&#039;);&lt;br /&gt;
		el.setAttribute(&#039;id&#039;,&#039;warning&#039;);&lt;br /&gt;
		document.body.appendChild(el);&lt;br /&gt;
		$( &#039;#warning&#039; ).css({&lt;br /&gt;
			&#039;border&#039;:&#039;1px solid #333333&#039;,&lt;br /&gt;
			&#039;width&#039;:&#039;200px&#039;,&lt;br /&gt;
			&#039;padding&#039;:&#039;3px&#039;,&lt;br /&gt;
			&#039;color&#039;:&#039;red&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;#warning&#039;).html(warningText);&lt;br /&gt;
		$(&#039;input[type=&amp;quot;submit&amp;quot;]&#039;).after($(&#039;#warning&#039;));&lt;br /&gt;
		&lt;br /&gt;
		// Detect the initial number of checked answers &amp;amp; display Next/Submit button accordingly&lt;br /&gt;
		var inputInitCount = 0;&lt;br /&gt;
		$(&#039;#question&#039; + questionId + &#039; input&#039;).each(function(i) {&lt;br /&gt;
			if ($( this ).attr(&#039;checked&#039;) == true ) {&lt;br /&gt;
				inputInitCount++;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
		if (inputInitCount &amp;gt; (minNumber - 1)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;submit&amp;quot;]&#039;).show();&lt;br /&gt;
			$(&#039;#warning&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#warning&#039;).show();&lt;br /&gt;
			$(&#039;input[type=&amp;quot;submit&amp;quot;]&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Listener to detect number of checked answers &amp;amp; display Next/Submit button accordingly&lt;br /&gt;
		$(&#039;#question&#039; + questionId + &#039; input.radio, #question&#039;+questionId+&#039; tbody[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;javatbd&amp;quot;] td&#039;).click(function() {&lt;br /&gt;
			var inputCount = 0;&lt;br /&gt;
			$(&#039;#question&#039; + questionId + &#039; input.radio&#039;).each(function(i) {&lt;br /&gt;
				if ($( this ).attr(&#039;checked&#039;) == true ) {&lt;br /&gt;
					inputCount++;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
			if (inputCount &amp;gt; (minNumber - 1)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;submit&amp;quot;]&#039;).show();&lt;br /&gt;
				$(&#039;#warning&#039;).hide();&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;#warning&#039;).show();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;submit&amp;quot;]&#039;).hide();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// The original functions of the click event&lt;br /&gt;
			checkconditions(this.value, this.name, this.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;
=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;
			}&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 - Multiple Options &amp;amp; List (radio) questions - ENHANCED=&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 the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping as many answers at the end of the list as specified by the var insertitems=n, where n is the number of answers you want left unrandomized. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the 5th to 7th displayed last as in the image below (assuming you assigned the number 3 to insertitems):&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;
Some conditions on the use of this are:&lt;br /&gt;
*For Select/radio type questions it will only work if the [[Optional settings#Survey Behavior|$shownoanswer option]] is set to 0 in config.php. (&amp;quot;No answer&amp;quot; is removed from the end of questions)&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_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 Options or List (radio) 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;
#Set var insertitems=n (n = the number of items you want un-randomized)&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. partRand(11111, 22, 1); partRand(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;&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 options and List/radio questions&lt;br /&gt;
&lt;br /&gt;
       function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
           //var to define how many lists to be added at the end&lt;br /&gt;
&lt;br /&gt;
           var insertitems=3;&lt;br /&gt;
&lt;br /&gt;
           // Find the number of answers&lt;br /&gt;
&lt;br /&gt;
           var ansCount = &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
           lastitems=new Array();&lt;br /&gt;
&lt;br /&gt;
           var liid=new Array();&lt;br /&gt;
&lt;br /&gt;
           var $ul;&lt;br /&gt;
&lt;br /&gt;
           var j=0;&lt;br /&gt;
&lt;br /&gt;
           $( &#039;#question&#039; + qID + &#039; td.answer li&#039; ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
                           ansCount = (i + 1);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$( &#039;#question&#039; + qID + &#039; td.answer li&#039; ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
                           if(i&amp;gt;ansCount-(insertitems+1)){&lt;br /&gt;
&lt;br /&gt;
                             lastitems[j]=$(this).html();&lt;br /&gt;
&lt;br /&gt;
                             liid[j]=$(this).attr(&amp;quot;id&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
                             j++;&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;
$( &#039;#question&#039; + qID + &#039; td.answer li&#039; ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
// get current ul&lt;br /&gt;
&lt;br /&gt;
$ul = $(this).parent();&lt;br /&gt;
&lt;br /&gt;
// get array of list items in current ul&lt;br /&gt;
&lt;br /&gt;
var $liArr = $ul.children(&#039;li&#039;);&lt;br /&gt;
&lt;br /&gt;
// sort array of list items in current ul randomly&lt;br /&gt;
&lt;br /&gt;
$liArr.sort(function(a,b){&lt;br /&gt;
&lt;br /&gt;
// Get a random number between 0 and 100&lt;br /&gt;
&lt;br /&gt;
var temp = parseInt( Math.random()*100 );&lt;br /&gt;
&lt;br /&gt;
// Get 1 or 0, whether temp is odd or even&lt;br /&gt;
&lt;br /&gt;
var isOddOrEven = temp%2;&lt;br /&gt;
&lt;br /&gt;
// Get +1 or -1, whether temp greater or smaller than 5&lt;br /&gt;
&lt;br /&gt;
var isPosOrNeg = temp&amp;gt;5 ? 1 : -1;&lt;br /&gt;
&lt;br /&gt;
// Return -1, 0, or +1&lt;br /&gt;
&lt;br /&gt;
return( isOddOrEven*isPosOrNeg );&lt;br /&gt;
&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
// append list items to ul&lt;br /&gt;
&lt;br /&gt;
.appendTo($ul);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$.each(lastitems,function(i){&lt;br /&gt;
&lt;br /&gt;
$( $ul ).append(&amp;quot;&amp;lt;li id=&amp;quot;+liid[i]+&amp;quot;&amp;gt;&amp;quot;+this+&amp;quot;&amp;lt;/li&amp;gt;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the SID, GID and QID&lt;br /&gt;
&lt;br /&gt;
       partRand(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;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) 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 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;
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;
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;
Some conditions on the use of this are:&lt;br /&gt;
*For Select/radio type questions it will only work if the [[Optional settings#Survey Behavior|$shownoanswer option]] is set to 0 in config.php. (&amp;quot;No answer&amp;quot; is removed from the end of questions)&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_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 Options or List (radio) 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. partRand(11111, 22, 1); partRand(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 options and List/radio 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; td.answer 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&lt;br /&gt;
			$( &#039;input#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).parent().appendTo($( &#039;#question&#039; + qID + &#039; td.answer ul&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
			partRand(SSSSS, GG, 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 - 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;
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;
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;
&#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;lt;/div&amp;gt;=&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: 1.87+ (7557), 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, many more question types support default values.&amp;lt;/div&amp;gt;&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;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;
       // A function to pre-check a column of an array&lt;br /&gt;
&lt;br /&gt;
       function checkedDefault(qID, column) {&lt;br /&gt;
&lt;br /&gt;
           var checkedCol = column - 1;&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;
               if ($(&#039;input.radio[checked=true]&#039;, this).length == 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;input.radio:eq(&#039; + checkedCol + &#039;)&#039;, this).attr(&#039;checked&#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;
       // Call the function with a question ID and column number&lt;br /&gt;
&lt;br /&gt;
       checkedDefault(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&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({&#039;margin-bottom&#039;:&#039;10px&#039;});&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.90 and previous versions==&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 the [http://docs.jquery.com/Plugins/Autocomplete jQuery Autocomplete] plugin 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;
I&#039;ve put together a small demonstration [http://www.partnersinc.biz/surveys//index.php?sid=78611&amp;amp;newtest=Y&amp;amp;lang=en here] and implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*[http://docs.jquery.com/Plugins/Autocomplete Download the plugin]&lt;br /&gt;
*Place the files &#039;&#039;jquery.autocomplete.css&#039;&#039; and &#039;&#039;jquery.autocomplete.js&#039;&#039; in your template directory&lt;br /&gt;
*Add the following code inside the &amp;lt;head&amp;gt; element of startpage.pstpl&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; src=&amp;quot;{TEMPLATEURL}jquery.autocomplete.js&amp;quot;&amp;gt;&amp;lt;/script&amp;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.autocomplete.css&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (&amp;quot;States&amp;quot; question in the demo):&#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 = QQ;&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(states, {&lt;br /&gt;
			matchContains: true,&lt;br /&gt;
			minChars: 0&lt;br /&gt;
		});&lt;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 (&amp;quot;Countries&amp;quot; question in the demo):&#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 countriesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$(data).each(function(i, item){&lt;br /&gt;
				countriesArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete(countriesArr, {&lt;br /&gt;
				matchContains: true,&lt;br /&gt;
				minChars: 0&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;
== 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 = QQ;&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;
== 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/source/browse/jquery.csv.js?r=f13189b2550a770ccaa777f1d747bc860b943fe7 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/source/browse/jquery.csv.js?r=f13189b2550a770ccaa777f1d747bc860b943fe7 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;
=Drag and Drop Rankings=&lt;br /&gt;
&lt;br /&gt;
==Drag and Drop Ranking - Version 1.90 to 1.92==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+ &amp;amp; 1.91RC4, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround is a modification of the workaround below and also uses [http://jqueryui.com/demos/sortable/#connect-lists JQuery connected sortables]. Thanks to the author of that workaround.&lt;br /&gt;
&lt;br /&gt;
[[File:Untitled-12.png]]&lt;br /&gt;
&lt;br /&gt;
Modifications include:&lt;br /&gt;
*Allow for multiple drag-n-drop ranking questions on a page&lt;br /&gt;
*Handle minimum and maximum answers settings&lt;br /&gt;
*Allow double clicking of items to add or remove them from the ranking list&lt;br /&gt;
*Work with the new shipped jQuery UI&lt;br /&gt;
&lt;br /&gt;
There is a &#039;&#039;&#039;[http://www.partnersinc.biz/surveys//index.php?sid=36981&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here]&#039;&#039;&#039;.&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 large script below in your template.js file.&lt;br /&gt;
#Place the small script below in the source a ranking question, (this applies the &amp;quot;dragDropRank&amp;quot; function to the question). Replace &amp;quot;QQ&amp;quot; with the ranking [http://docs.limesurvey.org/SGQA+identifier&amp;amp;structure;=English+Instructions+for+LimeSurvey#General_Description question ID].&lt;br /&gt;
**Note: the LimeSurvey translations will be automatically used for the &amp;quot;Choices&amp;quot; and &amp;quot;Rankings&amp;quot; header labels but can be overridden with custom labels - see the example calls below.&lt;br /&gt;
#Insert the CSS below at the end of template.css (these styles are for the default template).&lt;br /&gt;
&lt;br /&gt;
NOTE: I have not tested this workaround with conditions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Code for template.js:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function dragDropRank(qID, choiceText, rankText) {&lt;br /&gt;
&lt;br /&gt;
	if(!choiceText) {&lt;br /&gt;
		choiceText = $(&#039;#question&#039;+qID+&#039; td.label label&#039;).text();&lt;br /&gt;
	}&lt;br /&gt;
	if(!rankText) {&lt;br /&gt;
		rankText = $(&#039;#question&#039;+qID+&#039; td.output tr:first td:eq(1)&#039;).text();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	//Add a class to the question&lt;br /&gt;
	$(&#039;#question&#039;+qID+&#039;&#039;).addClass(&#039;dragDropRanking&#039;);&lt;br /&gt;
	&lt;br /&gt;
	// Hide the original question in LimeSurvey (so that we can replace with drag and drop)&lt;br /&gt;
	$(&#039;#question&#039;+qID+&#039; .rank, #question&#039;+qID+&#039; .questionhelp&#039;).hide();&lt;br /&gt;
	&lt;br /&gt;
	// Turn off display of question (to override error checking built into LimeSurvey ranking question)&lt;br /&gt;
	//$(&#039;#display&#039;+qID).val(&#039;off&#039;);&lt;br /&gt;
	&lt;br /&gt;
	// Add connected sortables elements to the question&lt;br /&gt;
	var htmlCode = &#039;&amp;lt;table class=&amp;quot;dragDropTable&amp;quot;&amp;gt; \&lt;br /&gt;
		&amp;lt;tbody&amp;gt; \&lt;br /&gt;
			&amp;lt;tr&amp;gt; \&lt;br /&gt;
				&amp;lt;td&amp;gt; \&lt;br /&gt;
					&amp;lt;span class=&amp;quot;dragDropHeader choicesLabel&amp;quot;&amp;gt;&#039;+choiceText+&#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; \&lt;br /&gt;
					&amp;lt;div class=&amp;quot;ui-state-highlight dragDropChoices&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;ul id=&amp;quot;sortable1&#039;+qID+&#039;&amp;quot; class=&amp;quot;connectedSortable&#039;+qID+&#039; dragDropChoiceList&amp;quot;&amp;gt; \&lt;br /&gt;
							&amp;lt;li&amp;gt;Choices&amp;lt;/li&amp;gt; \&lt;br /&gt;
						&amp;lt;/ul&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt; \&lt;br /&gt;
				&amp;lt;/td&amp;gt; \&lt;br /&gt;
				&amp;lt;td&amp;gt; \&lt;br /&gt;
					&amp;lt;span class=&amp;quot;dragDropHeader rankingLabel&amp;quot;&amp;gt;&#039;+rankText+&#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt; \&lt;br /&gt;
					&amp;lt;div class=&amp;quot;ui-state-highlight dragDropRanks&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;ol id=&amp;quot;sortable2&#039;+qID+&#039;&amp;quot; class=&amp;quot;connectedSortable&#039;+qID+&#039; dragDropRankList&amp;quot;&amp;gt; \&lt;br /&gt;
							&amp;lt;li&amp;gt;Ranks&amp;lt;/li&amp;gt; \&lt;br /&gt;
						&amp;lt;/ol&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt; \&lt;br /&gt;
				&amp;lt;/td&amp;gt; \&lt;br /&gt;
			&amp;lt;/tr&amp;gt; \&lt;br /&gt;
		&amp;lt;/tbody&amp;gt; \&lt;br /&gt;
					&amp;lt;/table&amp;gt;&#039;;&lt;br /&gt;
	$(htmlCode).insertAfter(&#039;#question&#039;+qID+&#039; table.rank&#039;);&lt;br /&gt;
	&lt;br /&gt;
	// Remove placeholder list items (have to have one item so that LimeSurvey doesn&amp;quot;t remove the &amp;lt;ul&amp;gt;)&lt;br /&gt;
	$(&#039;#sortable1&#039;+qID+&#039; li, #sortable2&#039;+qID+&#039; li&#039;).remove();&lt;br /&gt;
	&lt;br /&gt;
	// Load any previously-set values&lt;br /&gt;
	loadDragDropRank(qID);&lt;br /&gt;
	&lt;br /&gt;
	// Find the number of LimeSurvey ranking inputs (&amp;quot;Maximum answers&amp;quot;)&lt;br /&gt;
	var maxAnswer = $(&#039;#question&#039;+qID+&#039; td.output input.text&#039;).length;&lt;br /&gt;
	&lt;br /&gt;
	// Set up the connected sortable&lt;br /&gt;
	$(&#039;#sortable1&#039;+qID+&#039;, #sortable2&#039;+qID+&#039;&#039;).sortable({&lt;br /&gt;
		connectWith: &#039;.connectedSortable&#039;+qID+&#039;&#039;,&lt;br /&gt;
		placeholder: &#039;ui-sortable-placeholder&#039;,&lt;br /&gt;
		helper: &#039;clone&#039;,&lt;br /&gt;
		revert: 50,&lt;br /&gt;
		receive: function(event, ui) {&lt;br /&gt;
			if($(&#039;#sortable2&#039;+qID+&#039; li&#039;).length &amp;gt; maxAnswer) {&lt;br /&gt;
				alert (&#039;You can only rank a maximum of &#039;+maxAnswer+&#039; choices.&#039;);&lt;br /&gt;
				$(ui.sender).sortable(&#039;cancel&#039;);&lt;br /&gt;
			}&lt;br /&gt;
		},&lt;br /&gt;
		stop: function(event, ui) {&lt;br /&gt;
			$(&#039;#sortable1&#039;+qID+&#039;&#039;).sortable(&#039;refresh&#039;);&lt;br /&gt;
			$(&#039;#sortable2&#039;+qID+&#039;&#039;).sortable(&#039;refresh&#039;);&lt;br /&gt;
			updateDragDropRank(qID);&lt;br /&gt;
		}&lt;br /&gt;
	}).disableSelection();&lt;br /&gt;
	&lt;br /&gt;
	// Get the list of choices from the LimeSurvey question and copy them as items into the sortable choices list&lt;br /&gt;
	$(&#039;#CHOICES_&#039; + qID).children().each(function(index, Element) {&lt;br /&gt;
		var liCode = &#039;&amp;lt;li class=&amp;quot;ui-state-default&amp;quot; id=&amp;quot;choice_&#039; + $(this).attr(&amp;quot;value&amp;quot;) + &#039;&amp;quot;&amp;gt;&#039; + this.text + &#039;&amp;lt;/li&amp;gt;&#039;&lt;br /&gt;
		$(liCode).appendTo(&#039;#sortable1&#039;+qID+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Allow users to double click to move to selections from list to list&lt;br /&gt;
	$(&#039;#sortable1&#039;+qID+&#039; li&#039;).live(&#039;dblclick&#039;, function() {&lt;br /&gt;
		if($(&#039;#sortable2&#039;+qID+&#039; li&#039;).length == maxAnswer) {&lt;br /&gt;
			alert (&#039;You can only rank a maximum of &#039;+maxAnswer+&#039; choices.&#039;);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(this).appendTo(&#039;#sortable2&#039;+qID+&#039;&#039;);&lt;br /&gt;
			$(&#039;#sortable1&#039;+qID+&#039;&#039;).sortable(&#039;refresh&#039;);&lt;br /&gt;
			$(&#039;#sortable2&#039;+qID+&#039;&#039;).sortable(&#039;refresh&#039;);&lt;br /&gt;
			updateDragDropRank(qID);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;#sortable2&#039;+qID+&#039; li&#039;).live(&#039;dblclick&#039;, function() {&lt;br /&gt;
		$(this).appendTo(&#039;#sortable1&#039;+qID+&#039;&#039;);&lt;br /&gt;
		$(&#039;#sortable2&#039;+qID+&#039;&#039;).sortable(&#039;refresh&#039;);&lt;br /&gt;
		$(&#039;#sortable1&#039;+qID+&#039;&#039;).sortable(&#039;refresh&#039;);&lt;br /&gt;
		updateDragDropRank(qID);&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// This function copies the drag and drop sortable data into the LimeSurvey ranking list.&lt;br /&gt;
function updateDragDropRank(qID) {&lt;br /&gt;
&lt;br /&gt;
	// Reload the LimeSurvey choices select element&lt;br /&gt;
	var rankees = [];&lt;br /&gt;
	$(&#039;#sortable2&#039;+qID+&#039; li&#039;).each(function(index) {&lt;br /&gt;
		$(this).attr(&#039;value&#039;, index+1);&lt;br /&gt;
		&lt;br /&gt;
		// Get value of ranked item&lt;br /&gt;
		var liID = $(this).attr(&amp;quot;id&amp;quot;);&lt;br /&gt;
		liIDArray = liID.split(&#039;_&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Save to an array&lt;br /&gt;
		rankees[rankees.length] = { &amp;quot;r_name&amp;quot;:$(this).text(),&amp;quot;r_value&amp;quot;:liIDArray[1] };&lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;#question&#039;+qID+&#039; input[name&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;RANK_&amp;quot;]&#039;).each(function(index) {&lt;br /&gt;
		if (rankees.length &amp;gt; index) {&lt;br /&gt;
			$(this).val(rankees[index].r_name);&lt;br /&gt;
			$(this).next(&#039;input&#039;).attr(&#039;value&#039;, rankees[index].r_value);&lt;br /&gt;
		} else {&lt;br /&gt;
			$(this).val(&#039;&#039;);&lt;br /&gt;
			$(this).next().val(&#039;&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	 });&lt;br /&gt;
	 &lt;br /&gt;
	// Reload the LimeSurvey choices select element (we need this for &amp;quot;Minimum answers&amp;quot; code)&lt;br /&gt;
	$(&#039;#question&#039;+qID+&#039; td.label select option&#039;).remove();&lt;br /&gt;
	$(&#039;#sortable1&#039;+qID+&#039; li&#039;).each(function(index) {&lt;br /&gt;
		var liText = $(this).text();&lt;br /&gt;
		var liID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
		liIDArray = liID.split(&#039;_&#039;);&lt;br /&gt;
		var optionCode = &#039;&amp;lt;option value=&amp;quot;&#039;+liIDArray[1]+&#039;&amp;quot;&amp;gt;&#039;+liText+&#039;&amp;lt;/option&amp;gt;&#039;;&lt;br /&gt;
		$(optionCode).appendTo(&#039;#question&#039;+qID+&#039; td.label select&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Hack for IE6&lt;br /&gt;
	if ($.browser.msie &amp;amp;&amp;amp; $.browser.version.substr(0,1)&amp;lt;7) {&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; select&#039;).show();&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; select&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// This function is called on page load to see if there are any items already ranked (from a previous visit&lt;br /&gt;
// or cached due to a page change.  If so, the already-ranked items are loaded into the sortable list&lt;br /&gt;
function loadDragDropRank(qID) {&lt;br /&gt;
&lt;br /&gt;
	var rankees = [];&lt;br /&gt;
	&lt;br /&gt;
	// Loop through each item in the built-in LimeSurvey ranking list looking for non-empty values&lt;br /&gt;
	$(&#039;#question&#039;+qID+&#039; input[name&amp;lt;/div&amp;gt;=&amp;quot;RANK_&amp;quot;]&#039;).each(function(index) {&lt;br /&gt;
	&lt;br /&gt;
		// Check to see if the current item has a value&lt;br /&gt;
		if ($(this).val()) {&lt;br /&gt;
		&lt;br /&gt;
			// Item has a value - save to the array&lt;br /&gt;
			// Use this element to contain the name and the next for the value (numeric)&lt;br /&gt;
			rankees[rankees.length] = { &amp;quot;r_name&amp;quot;:$(this).val(),&amp;quot;r_value&amp;quot;:$(this).next().val() };&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Now that we have a list of all the pre-ranked items, populate the sortable list&lt;br /&gt;
	// Note that the items *won&amp;quot;t* appear in the main list because LimeSurvey has removed them.&lt;br /&gt;
	$.each(rankees, function(index, value) {&lt;br /&gt;
	&lt;br /&gt;
		// Create the items in the sortable&lt;br /&gt;
		var liCode = &#039;&amp;lt;li class=&amp;quot;ui-state-default&amp;quot; id=&amp;quot;choice_&#039; + value.r_value + &#039;&amp;quot;&amp;gt;&#039; + value.r_name + &#039;&amp;lt;/li&amp;gt;&#039;;&lt;br /&gt;
		$(liCode).appendTo(&#039;#sortable2&#039;+qID+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Code in the source of the question(s) using the LimeSurvey translations for the &amp;quot;Choices&amp;quot; and &amp;quot;Rankings&amp;quot; element header labels&#039;&#039;&#039; (replace &amp;quot;QQ&amp;quot; with the ranking [http://docs.limesurvey.org/SGQA+identifier&amp;amp;structure;=English+Instructions+for+LimeSurvey#General_Description 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;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		dragDropRank(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;
&#039;&#039;&#039;Code in the source of the question(s) using custom text for the &amp;quot;Choices&amp;quot; and &amp;quot;Rankings&amp;quot; element header labels&#039;&#039;&#039; (replace &amp;quot;QQ&amp;quot; with the ranking [http://docs.limesurvey.org/SGQA+identifier&amp;amp;structure;=English+Instructions+for+LimeSurvey#General_Description 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;&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;
		dragDropRank(QQ, &#039;Custom Choices Label&#039;, &#039;Custom Rankings Label&#039;);&lt;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;Styles for template.css:&#039;&#039;&#039;&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;
/* Drag-n-drop ranking styles */&lt;br /&gt;
.dragDropTable {&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.dragDropTable td {&lt;br /&gt;
	vertical-align: top;&lt;br /&gt;
	width: 50%;&lt;br /&gt;
	padding-right: 20px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.dragDropTable .dragDropHeader {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.dragDropTable .dragDropChoices,&lt;br /&gt;
.dragDropTable .dragDropRanks {&lt;br /&gt;
	margin: 5px 0 0 0;&lt;br /&gt;
	background: transparent none;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.dragDropTable .dragDropChoiceList,&lt;br /&gt;
.dragDropTable .dragDropRankList {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	min-height: 2.4em;&lt;br /&gt;
	_height: 2.4em; /* IE6 and below hack */&lt;br /&gt;
	margin: 0;&lt;br /&gt;
	padding: 0;&lt;br /&gt;
	list-style-type: none;&lt;br /&gt;
	background: #FBFBFB none;&lt;br /&gt;
	border: 1px solid #CCCCCC;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.dragDropTable .dragDropChoiceList li,&lt;br /&gt;
.dragDropTable .dragDropRankList li {&lt;br /&gt;
	margin: 3px;&lt;br /&gt;
	*margin-left: -13px; /* IE7 and below */&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
	min-height: 1.3em;&lt;br /&gt;
	_height: 1.3em; /* IE6 and below hack */&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	cursor: move;&lt;br /&gt;
	display: block; /* Force the li to full width */&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Drag and Drop Ranking using Images - Version 1.90 to 1.92==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+ &amp;amp; 1.91RC4, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround works in conjunction with the above workaround to allow ranking of images.&lt;br /&gt;
&lt;br /&gt;
[[File:Untitled-11.png]]&lt;br /&gt;
&lt;br /&gt;
There is a &#039;&#039;&#039;[http://www.partnersinc.biz/surveys//index.php?sid=36981&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) Follow the above workaround to get basic drag-n-drop functionality in your ranking question.&lt;br /&gt;
&lt;br /&gt;
2) Insert your images in the ranking question text or help section after any text that you wish to have there (we&#039;ll move them later with JavaScript).&lt;br /&gt;
&lt;br /&gt;
3) Give the images &#039;&#039;&#039;EXACTLY&#039;&#039;&#039; the same IDs as the answer code you would like them to be associated with:[[File:Untitled-8.png]]&lt;br /&gt;
&lt;br /&gt;
4) Place the first script below in your template.js file.&lt;br /&gt;
&lt;br /&gt;
5) Place the second script below in the source the ranking question &#039;&#039;&#039;AFTER&#039;&#039;&#039; the initial call for the dragDropRank function from the workaround above. Replace &amp;quot;QQ&amp;quot; with the ID of the ranking question (this applies the &amp;quot;dragDropRankImages&amp;quot; function to the question).&lt;br /&gt;
&lt;br /&gt;
6) Insert the CSS below at the end of template.css. Replace &amp;quot;11&amp;quot; with your question ID. These styles are for the default template using 50x50px images (as in the demo) and may need to be modified for other templates or image sizes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Code for template.js:&#039;&#039;&#039;&lt;br /&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;
function dragDropRankImages(qID) {&lt;br /&gt;
&lt;br /&gt;
	$(&#039;.connectedSortable&#039;+qID+&#039; li&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
		// Remove any text in the sortable choice or rank items&lt;br /&gt;
		$(this).text(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Move the images into the appropriate sortable list item&lt;br /&gt;
		var liID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
		liIDArray = liID.split(&#039;_&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; img#&#039;+liIDArray[1]+&#039;&#039;).appendTo(this);&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Code in the source of the question(s):&#039;&#039;&#039;&lt;br /&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;
		dragDropRankImages(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;
&#039;&#039;&#039;Styles for template.css:&#039;&#039;&#039;&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;
&lt;br /&gt;
/* Drag-n-drop for ranking images */&lt;br /&gt;
#question11 .dragDropTable {&lt;br /&gt;
	width: auto;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#question11 .dragDropTable .dragDropChoiceList,&lt;br /&gt;
#question11 .dragDropTable .dragDropRankList {&lt;br /&gt;
	min-height: 60px;&lt;br /&gt;
	_height: 60px; /* IE6 and below hack */&lt;br /&gt;
	width: auto;&lt;br /&gt;
	min-width: 60px;&lt;br /&gt;
	_width: 60px; /* IE6 and below hack */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#question11 .dragDropTable li {&lt;br /&gt;
	background: 0 none;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
	height: 50px;&lt;br /&gt;
	width: 50px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#question11 .dragDropTable li img {&lt;br /&gt;
	margin: 0;&lt;br /&gt;
	padding: 0;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Drag and Drop Ranking for iPad - Version 1.91 and newer==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.91, iPad 2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround extends the above workarounds to work with the touch interface on iPads.&lt;br /&gt;
&lt;br /&gt;
1) Follow the [[Workarounds: Manipulating a survey at runtime using Javascript#Drag and Drop Ranking - Version 1.90 and newer|Drag and Drop Ranking - Version 1.90 and newer]] workaround above to get basic drag-n-drop functionality in your ranking question.&lt;br /&gt;
&lt;br /&gt;
2) Download the [https://github.com/furf/jquery-ui-touch-punch jQuery.ui.touch-punch.js plugin] and save it in your template directory.&lt;br /&gt;
&lt;br /&gt;
3) Replace this line in your startpage.pstpl:&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}template.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;With this:&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.ui.touch-punch.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; src=&amp;quot;{TEMPLATEURL}template.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Drag and Drop Ranking - Version 1.86==&lt;br /&gt;
&lt;br /&gt;
Tested with 1.86 on IE 7,8, FireFox 3, Chrome, and Safari 4&lt;br /&gt;
&lt;br /&gt;
This workaround uses [http://jqueryui.com/demos/sortable/#connect-lists JQuery connected sortables] to modify a ranking question and allow the survey taker to drag and drop choices instead of clicking.  The nice thing is that the choices can be easily re-arranged or removed from the ranking, all by drag and drop.&lt;br /&gt;
&lt;br /&gt;
I used it for a voting application and some of the element names reflect that use.&lt;br /&gt;
&lt;br /&gt;
It looks best when some CSS is added to control the appearance of the boxers around each choice.&lt;br /&gt;
&lt;br /&gt;
[[File:drag-n-drop.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
	// Question ID global variable&lt;br /&gt;
	var questionID;&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// Grab the question ID[[File:drag-n-drop.png]]&lt;br /&gt;
		// This is something with a class of &amp;quot;ranking&amp;quot; and an ID that starts with &amp;quot;questionXXXXX&amp;quot;.  The X&#039;s represent the question ID&lt;br /&gt;
		var entire_questionID = $(&amp;quot;.ranking[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&#039;question&#039;]&amp;quot;).attr(&#039;id&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Get just the question number (ID)&lt;br /&gt;
		var patt=/\d+$/;&lt;br /&gt;
		questionID=patt.exec(entire_questionID);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the original quetion in LimeSurvey (so that we can replace with drag and drop)&lt;br /&gt;
		$(&amp;quot;.rank, .questionhelp&amp;quot;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Turn off display of question (to override error checking built into LimeSurvey ranking question)&lt;br /&gt;
		$(&amp;quot;#display&amp;quot;+questionID).val(&amp;quot;off&amp;quot;);&lt;br /&gt;
		&lt;br /&gt;
		// Add connected sortables to the question&lt;br /&gt;
		var html_code = &amp;quot;&amp;lt;table style=&#039;border: medium none ; width: 770px; margin-left: auto; \&lt;br /&gt;
								margin-right: auto;&#039;&amp;gt;&amp;lt;tbody&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td style=&#039;width: 590px; vertical-align: top;&#039;&amp;gt;&amp;lt;h3&amp;gt;List of Candidates:&amp;lt;/h3&amp;gt; \&lt;br /&gt;
								&amp;lt;div class=&#039;ui-state-highlight&#039; style=&#039;margin: 5px; float: left;&#039; id=&#039;ballot_list&#039;&amp;gt; \&lt;br /&gt;
								&amp;lt;ul id=&#039;sortable1&#039; class=&#039;connectedSortable&#039;&amp;gt;&amp;lt;li&amp;gt;Candidates&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt; \&lt;br /&gt;
								&amp;lt;td style=&#039;vertical-align: top;&#039;&amp;gt;&amp;lt;h3&amp;gt;Your selections:&amp;lt;/h3&amp;gt;&amp;lt;div class=&#039;ui-state-highlight&#039; \&lt;br /&gt;
								style=&#039;margin: 5px; float: left;&#039; id=&#039;voting_selections&#039;&amp;gt;&amp;lt;ol id=&#039;sortable2&#039; class=&#039;connectedSortable&#039;&amp;gt; \&lt;br /&gt;
								&amp;lt;li&amp;gt;Voting Area&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/tbody&amp;gt;&amp;lt;/table&amp;gt;&amp;quot;;&lt;br /&gt;
		$(html_code).appendTo(&amp;quot;#question&amp;quot; + questionID);&lt;br /&gt;
		&lt;br /&gt;
		// Remove list items (have to have one item so that LimeSurvey doesn&#039;t remove the &amp;lt;ul&amp;gt;)&lt;br /&gt;
		$(&amp;quot;#sortable1 li, #sortable2 li&amp;quot;).remove();&lt;br /&gt;
		&lt;br /&gt;
		// Load any previously-set values&lt;br /&gt;
		loadRanking();&lt;br /&gt;
		&lt;br /&gt;
		// Load jQuery UI&lt;br /&gt;
		$.getScript(&amp;quot;/scripts/jquery/jquery-ui.js&amp;quot;, function() {&lt;br /&gt;
		&lt;br /&gt;
			// After JQuery UI finishes loading, set up the connected sortable.&lt;br /&gt;
			$(&amp;quot;#sortable1, #sortable2&amp;quot;).sortable({&lt;br /&gt;
				connectWith: &#039;.connectedSortable&#039;,&lt;br /&gt;
				placeholder: &#039;ui-sortable-placeholder&#039;,&lt;br /&gt;
				stop: function(event, ui) {&lt;br /&gt;
					$(&amp;quot;#sortable1&amp;quot;).sortable(&amp;quot;refresh&amp;quot;);&lt;br /&gt;
					$(&amp;quot;#sortable2&amp;quot;).sortable(&amp;quot;refresh&amp;quot;);&lt;br /&gt;
					updateRanking();&lt;br /&gt;
					}&lt;br /&gt;
			}).disableSelection();&lt;br /&gt;
			&lt;br /&gt;
			// Get the list of candidates from the built-in LimeSurvey question and copy them as items in sortable1&lt;br /&gt;
			$(&amp;quot;#CHOICES_&amp;quot; + questionID).children().each(function(index, Element) {&lt;br /&gt;
				li_tag = &amp;quot;&amp;lt;li class=&#039;ui-state-default&#039; id=&#039;choice_&amp;quot; + $(this).attr(&#039;value&#039;) + &amp;quot;&#039;&amp;gt;&amp;quot; + this.text + &amp;quot;&amp;lt;/li&amp;gt;&amp;quot;&lt;br /&gt;
				$(li_tag).appendTo(&amp;quot;#sortable1&amp;quot;); }	);&lt;br /&gt;
				&lt;br /&gt;
			// Make sure the submit button is showing&lt;br /&gt;
			$(&amp;quot;:submit[value|=&#039; Submit&#039;]&amp;quot;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Show a confirmation alert upon submit&lt;br /&gt;
			$(&amp;quot;form&amp;quot;).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;
				var validated = confirm(&amp;quot;Cast your ballot now?&amp;quot;);&lt;br /&gt;
				if (validated) { return true; } else { return false; }&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Allow users to double click to move to selection list&lt;br /&gt;
			$(&amp;quot;#sortable1 li&amp;quot;).assignDblClick();&lt;br /&gt;
		});  // End of JQuery UI loading&lt;br /&gt;
		&lt;br /&gt;
	}); // End of JQuery ready function&lt;br /&gt;
	&lt;br /&gt;
// Define the actions when an item is double clicked&lt;br /&gt;
$.fn.assignDblClick = function() {&lt;br /&gt;
	$(this).dblclick(function(){&lt;br /&gt;
		$(this).appendTo(&#039;#sortable2&#039;);&lt;br /&gt;
		$(&amp;quot;#sortable1&amp;quot;).sortable(&amp;quot;refresh&amp;quot;);&lt;br /&gt;
		$(&amp;quot;#sortable2&amp;quot;).sortable(&amp;quot;refresh&amp;quot;);&lt;br /&gt;
		updateRanking();&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// This function copies the drag and drop sortable data into the standard LimeSurvey ranking structure.&lt;br /&gt;
function updateRanking() {&lt;br /&gt;
	var rankees = [];&lt;br /&gt;
	$(&#039;#sortable2 li&#039;).each(function(index) {&lt;br /&gt;
	$(this).attr(&amp;quot;value&amp;quot;, index+1);&lt;br /&gt;
	&lt;br /&gt;
		// Get value of person&lt;br /&gt;
		li_tag = $(this).attr(&#039;id&#039;);&lt;br /&gt;
		li_tag_array = li_tag.split(&amp;quot;_&amp;quot;);&lt;br /&gt;
		&lt;br /&gt;
		// Save to an array&lt;br /&gt;
		rankees[rankees.length] = { &#039;r_name&#039;:$(this).text(),&#039;r_value&#039;:li_tag_array[1] };&lt;br /&gt;
	});&lt;br /&gt;
	$(&amp;quot;input[name&amp;lt;/div&amp;gt;=&#039;RANK_&#039;]&amp;quot;).each(function(index) {&lt;br /&gt;
		if (rankees.length &amp;gt; index) {&lt;br /&gt;
			$(this).val(rankees[index].r_name);&lt;br /&gt;
			$(this).next().val(rankees[index].r_value);&lt;br /&gt;
		} else {&lt;br /&gt;
			$(this).val(&amp;quot;&amp;quot;);&lt;br /&gt;
			$(this).next().val(&amp;quot;&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	 });&lt;br /&gt;
	 &lt;br /&gt;
	// Re-assign double click action to first list items and remove&lt;br /&gt;
	// double click action from section list items&lt;br /&gt;
	$(&#039;#sortable1 li&#039;).unbind(&#039;dblclick&#039;).assignDblClick();&lt;br /&gt;
	$(&#039;#sortable2 li&#039;).unbind(&#039;dblclick&#039;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// This function is called on page load to see if there are any items already ranked (from a previous visit&lt;br /&gt;
// or cached due to a page change.  If so, the already-ranked items are loaded into the sortable list&lt;br /&gt;
function loadRanking() {&lt;br /&gt;
	var rankees = [];&lt;br /&gt;
	&lt;br /&gt;
	// Loop through each item in the built-in LimeSurvey ranking list looking for non-empty values&lt;br /&gt;
	$(&amp;quot;input[name&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&#039;RANK_&#039;]&amp;quot;).each(function(index) {&lt;br /&gt;
	&lt;br /&gt;
		// Check to see if the current item has a value&lt;br /&gt;
		if ($(this).val()) {&lt;br /&gt;
			// Item has a value - save to the array&lt;br /&gt;
			// Use this element to contain the name and the next for the value (numeric)&lt;br /&gt;
			rankees[rankees.length] = { &#039;r_name&#039;:$(this).val(),&#039;r_value&#039;:$(this).next().val() };&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Now that we have a list of all the pre-ranked items, populate the sortable list&lt;br /&gt;
	// Note that the items *won&#039;t* appear in the main list because LimeSurvey has removed them.&lt;br /&gt;
	$.each(rankees, function(index, value) {&lt;br /&gt;
		// Create the items in the sortable&lt;br /&gt;
		li_tag = &amp;quot;&amp;lt;li class=&#039;ui-state-default&#039; id=&#039;choice_&amp;quot; + value.r_value + &amp;quot;&#039;&amp;gt;&amp;quot; + value.r_name + &amp;quot;&amp;lt;/li&amp;gt;&amp;quot;;&lt;br /&gt;
		$(li_tag).appendTo(&amp;quot;#sortable2&amp;quot;);&lt;br /&gt;
	});&lt;br /&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: 2.05, IE 7-10, Firefox&#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 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 script in the source of the array question.&lt;br /&gt;
&lt;br /&gt;
NOTE: Care should be taken when using this script and conditional questions on the same page.&lt;br /&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;
		// 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;table.question tbody td&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;table.question tbody tr&#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;table.question tbody td&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			&lt;br /&gt;
			// Set some vars&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(this).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=checkbox]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=checkbox]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;table.question tbody td input[type=checkbox]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			&lt;br /&gt;
			// Set some vars&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
			var thisCell = $(this).closest(&#039;td&#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=checkbox]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=checkbox]&#039;, thisRow).attr(&#039;checked&#039;, 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;
=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;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0, IE 7-10, Firefox, Chrome, iPad&#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;
		mobile = true;&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;
&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;/div&gt;</summary>
		<author><name>Urbana</name></author>
	</entry>
</feed>