Welcome, Guest
Username: Password: Remember me

TOPIC: Check and uncheck with code

Check and uncheck with code 6 months 14 hours ago #105756

  • SurveyDennis
  • SurveyDennis's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Thank you received: 1
  • Karma: 1
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
The administrator has disabled public write access.

Check and uncheck with code 6 months 10 hours ago #105768

  • SurveyDennis
  • SurveyDennis's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Thank you received: 1
  • Karma: 1
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 );
   }
Last Edit: 6 months 10 hours ago by SurveyDennis.
The administrator has disabled public write access.

Check and uncheck with code 5 months 3 weeks ago #105777

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1068
  • Thank you received: 235
  • Karma: 74
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

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
The administrator has disabled public write access.

Check and uncheck with code 5 months 3 weeks ago #105778

  • SurveyDennis
  • SurveyDennis's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Thank you received: 1
  • Karma: 1
Hi Ben,

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

Dennis
The administrator has disabled public write access.
The following user(s) said Thank You: Ben_V

Check and uncheck with code 5 months 3 weeks ago #105783

  • SurveyDennis
  • SurveyDennis's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Thank you received: 1
  • Karma: 1
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
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.214 seconds
Donation Image