Hide "This Question is mandatory" after start typing

More
3 months 1 week ago #184169 by cmnxyz
Hey Guys,


i have the following Problem: I have a mandatory free text question. When I dont answer the free text and wanna continue to next page the standard message is displayed: "This question needs to be answered." So far, so good.


When i begin to answer the question the message "This question needs to be answered." is still displayed, which might distract users. So i want to hide this message as soon as users start to type.

Is there any chance to do this on runtime?

Thank you! :)

Attachments:

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
3 months 1 week ago #184222 by tpartner
Disable AJAX mode in the survey theme options and add this script to the question source:

<script type="text/javascript" charset="utf-8">
 
	$(document).on('ready pjax:scriptcomplete',function(){
 
		// Listener on the input
		$('#question{QID} input:text').on('keyup change', function(e) {
			if($.trim($(this).val()) != '') {
				$('#question{QID} .ls-question-mandatory.text-danger').hide();
			}
		});
 
	});
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...3312.lss
File Size:13 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Attachments:
The following user(s) said Thank You: cdorin, cmnxyz

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!