Check and uncheck with code

More
3 years 1 month ago #105756 by SurveyDennis
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.

Please Log in to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #105768 by SurveyDennis
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: 3 years 1 month ago by SurveyDennis.

Please Log in to join the conversation.

More
3 years 3 weeks ago #105777 by Ben_V
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
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

More
3 years 3 weeks ago #105778 by SurveyDennis
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 following user(s) said Thank You: Ben_V

Please Log in to join the conversation.

More
3 years 3 weeks ago #105783 by SurveyDennis
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.

Please Log in to join the conversation.