Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Check and uncheck with code

Check and uncheck with code 2 years 9 months ago #105756

  • SurveyDennis
  • SurveyDennis's Avatar
  • Offline
  • Junior Lime
  • Posts: 29
  • Thank you received: 6
  • Karma: 2
Hi,

I am using an image and depended on the areas selected on that image I would like to get the answer 'punched'.

All working with some old code, however not anymore.

I probably only have a setting wrong in the coding.
Checking is working however unchecking not.
Maybe somebody spots it already:

if (alt === 'head') {
   if ( $('#answer313628X20X42A1').attr('checked') == true){
   $('#answer313628X20X42A1').attr('checked',false);
   }
   else {
   $('#answer313628X20X42A1').attr('checked',true);
   }
} 
 


In the demo below only the left image is working and then only the areas in the head.

survey

Many thanks, dennis
Design is a method of problem solving. Applying design in surveys helps solving the biggest challenges we currently face in market research.
The administrator has disabled public write access.

Check and uncheck with code 2 years 9 months ago #105768

  • SurveyDennis
  • SurveyDennis's Avatar
  • Offline
  • Junior Lime
  • Posts: 29
  • Thank you received: 6
  • Karma: 2
this post can be closed, sorry for asking I found the solution in the meantime.

it worked with the .prop

   if ($('#answer313628X20X42A1').is(':checked')) {
       $( '#answer313628X20X42A1' ).prop( "checked", false );
   }
   else {
       $( '#answer313628X20X42A1' ).prop( "checked", true );
   }
Design is a method of problem solving. Applying design in surveys helps solving the biggest challenges we currently face in market research.
Last Edit: 2 years 9 months ago by SurveyDennis.
The administrator has disabled public write access.

Check and uncheck with code 2 years 9 months ago #105777

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1894
  • Thank you received: 469
  • Karma: 118
Hi Dennis,

I'm glad that your "body image map" question is now working fine.
It would be very nice if you can provide an export and/or hints, because it will be very useful for other users using limesurvey for rheumatology assessment or research.

Ben.
Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
All LS releases => bit.ly/1VMuTDu | 2.06lts => bit.ly/1Qv44A1
Demo surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The administrator has disabled public write access.

Check and uncheck with code 2 years 9 months ago #105778

  • SurveyDennis
  • SurveyDennis's Avatar
  • Offline
  • Junior Lime
  • Posts: 29
  • Thank you received: 6
  • Karma: 2
Hi Ben,

Yes for sure, I make sure to document this in the weekend and share it here!

Dennis
Design is a method of problem solving. Applying design in surveys helps solving the biggest challenges we currently face in market research.
The administrator has disabled public write access.
The following user(s) said Thank You: Ben_V

Check and uncheck with code 2 years 9 months ago #105783

  • SurveyDennis
  • SurveyDennis's Avatar
  • Offline
  • Junior Lime
  • Posts: 29
  • Thank you received: 6
  • Karma: 2
I have added some documentation about this on my site - feel free to copy and paste it.

Howto define areas on image and use them as answers:
Quick howto

Demo:
Demo
Design is a method of problem solving. Applying design in surveys helps solving the biggest challenges we currently face in market research.
The administrator has disabled public write access.
Time to create page: 0.224 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form