Check out the LimeSurvey source code on GitHub!

Check answer from an image map and conditions

4 years 10 months ago #77750 by nkorf
Dear all,
I have an image map made clickable by coding the default template. Once the user clicks on the image a multiple choice question checkbox is checked (did it by following the javascript instructions in the manual). So far so good!
However when this checkbox is checked a condition is attached to it in order to show another question. While it works fine when the user checks this checkbox if i check the checkbox programmatically (from the image map using javascript) the conditional question is not shown.
Has anyone encountered this and found a solution ?

Please Log in to join the conversation.

4 years 10 months ago #77752 by TMSWhite
Did you call checkconditions() after changing the value of the widget that shows the value?

The syntax is checkconditions(this.value,, this.type). If you need to see the specific syntax for your question type (e.g. short free text?), load this sample survey , which demonstrates dynamic tailoring for all question types.

Please Log in to join the conversation.

4 years 10 months ago #77820 by nkorf
Hi Thomas,
This question is multiple choice. I have an imagemap showing a sceleton and when i click on an area in the image map one of the multiple options is checked. The js function looks like this
else ....

I tried to add the following code:
checkconditions(this.value,, this.type)
after the javascript but didn't do the trick and i lost half of my day trying.
Thank you for taking time to have a look at this


Please Log in to join the conversation.

4 years 10 months ago #77821 by TMSWhite

Take a look at the sample surveys and see if they help. They show all of the question types, and you can see exactly how checkconditions() is called from the question types you are using.

Please Log in to join the conversation.

4 years 10 months ago #77823 by DenisChenu

You can use the triggerHandler jquery function.

Then you script are:
else ....

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

4 years 10 months ago #77826 by nkorf
That is also neat thank you ! i was just about to post my solution. Actually its exactly what TMS has suggested. The more expanded version is that you use
the checkconditions() function attached to the checkbox and call it from your javascript using the attributes of the question (value, name,type) available next to the question options.

Please Log in to join the conversation.

3 years 6 months ago #98868 by pgnkassel

my Code is not working. What is wrong? :(
Which type of question must i choose?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ""><html><head><title>QGIS</title><script type="text/javascript">
function mapOnMouseOver(str){document.getElementById("mousemovemessage").innerHTML=str; }
function mapOnMouseOut(str){document.getElementById("mousemovemessage").innerHTML="out of "+str; }
function mapOnClick(str){alert(str);}
</script> </head> <body><div id="mousemovemessage"></div><br><img src="Gewerbestandorte.png" border="0" ismap="ismap" usemap="#mapmap" alt="html imagemap created with QGIS" >
<map name="mapmap">
<area shape="poly" href=""  coords="611,413,611,411,611" alt="1">
<area shape="poly" href=""  coords="735,495,734,494,734" alt="2">
<area shape="poly" href=""  coords="212,592,212,587,212" alt="3">
<area shape="poly" href=""  coords="241,727,264,727,265" alt="4">
<area shape="poly" href=""  coords="596,107,596,105,595" alt="5">
<area shape="poly" href=""  coords="627,439,624,442,614" alt="6">
<area shape="poly" href=""  coords="150,300,150,302,147" alt="7">
<area shape="poly" href=""  coords="146,283,147,283,147" alt="8">
<area shape="poly" href=""  coords="103,509,301,506,301" alt="9">
<area shape="poly" href=""  coords="442,404,443,403,443" alt="10">
<area shape="poly" href=""  coords="408,497,408,498,407" alt="11">
<script type="text/javascript" charset="utf-8">
$('area').click(function() {
    var alt = $(this).attr('alt');
    $("#question42 input.text").val(alt);
  return false;

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form