Welcome, Guest
Username: Password: Remember me

TOPIC: smiley face without radiobutton and submitting

Re: smiley face without radiobutton and submitting 2 years 4 months ago #82537

Thanks so so much for your support, I don´t really know why it doesn´t work, with that code the radio buttons and submit buttons are visible to the left side of the screen breaking a little bit the format.
I was thinking why i want to do something that diferent if LimeSurvey offer a star rating JQuery Plugin that works very good. So to stop the hassle im going with it, (I will keep trying to fix my mistake with your code, is a good practice for a rookie) but now I just want to auto submit the question when you click on the rating. I tried tu cut your code to just include that part of the code but is not working. Can you help with it?
			// Click events
			$('#question'+qID+' .clickableImage').click(function(){
				$('#question'+qID+' .clickableImageSelected').removeClass('clickableImageSelected');
				$(this).addClass('clickableImageSelected');
				var imgIndex = $(this).attr('id').split(qID+'-')[1];
				$('#question'+qID+' input.radio:eq('+imgIndex+')').click();
				// Submit the page
				if($('#movesubmitbtn').length > 0) {
					document.limesurvey.move.value = 'movesubmit';
				}
				else {
					document.limesurvey.move.value = 'movenext';
				}
				document.limesurvey.submit();
			});
		}
	});
 
</script>
Last Edit: 2 years 4 months ago by manueltrevilla.
The administrator has disabled public write access.

Re: smiley face without radiobutton and submitting 2 years 4 months ago #82565

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4281
  • Thank you received: 807
  • Karma: 370
This will submit the page when you click a star:
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function(){
 
		$('.star-rating').click(function(){
			if($('#movesubmitbtn').length > 0) {
				document.limesurvey.move.value = 'movesubmit';
			}
			else {
				document.limesurvey.move.value = 'movenext';
			}
			document.limesurvey.submit();
		});
	});
 
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.120 seconds
Donation Image