Provide read only answer for one subquestion

More
2 years 10 months ago #124053 by mikeg
mikeg created the topic: Provide read only answer for one subquestion
In my survey I am asking students to explain the importance of 4 out of 5 topics using a 'multiple short text'. The 5th explanation will come from the instructor and serve as an exemplar for the students. I am wondering how the heck to do something like this

In the example below students would provide the text for <student response> and the instructor's exemplar response is provided ahead of time and is in double quotes.

Topic 1: Replication Initiation <student response>
Topic 2: Error Checking "Error checking is critical to DNA replication because errors...>
Topic 3: Lagging vs Leading <student response>
.
.
.

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

More
2 years 10 months ago #124055 by holch
holch replied the topic: Provide read only answer for one subquestion
Use the question type "text display" or include the explanation in the question text itself.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

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

More
2 years 10 months ago #124065 by jelo
jelo replied the topic: Provide read only answer for one subquestion
You can set input fields to readonly via JQuery. You might upload your question here to ensure the right workaround is applied.

To get an impression what I mean, here is an example to ensure that a checkbox answer is always checked.
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
                var qID = {QID};
                var answer = $('input[id$="X'+qID+'A1"]');
                $(answer).attr('disabled', true);
                $(answer).prop('readonly', true);
         });
</script>

There are other examples here in the forum.

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

More
2 years 10 months ago #124083 by tpartner
tpartner replied the topic: Provide read only answer for one subquestion
Just a little tip to add to jelo's post - be careful when rendering inputs "disabled". If the input remains disabled when the form is submitted, its value may not be recorded in the data.

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

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

More
2 years 10 months ago #124085 by jelo
jelo replied the topic: Provide read only answer for one subquestion

tpartner wrote: If the input remains disabled when the form is submitted, its value may not be recorded in the data.

Is that behavior depending on the browser? Or on Limesurvey and shipped JS libraries?

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

More
2 years 10 months ago - 2 years 10 months ago #124086 by tpartner
tpartner replied the topic: Provide read only answer for one subquestion
That is browser behaviour. All browsers should adhere to that. More info - www.w3.org/TR/html401/interact/forms.html#successful-controls .

I always do something like:

<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
		var qID = {QID};
		var answer = $('input[id$="X'+qID+'A1"]');
 
		$(answer).prop('disabled', true);
		$(answer).prop('readonly', true);
 
        $('#movenextbtn, #movesubmitbtn').click(function() {
            $(answer).prop('disabled', false);
        });
	});
</script>

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 2 years 10 months ago by tpartner.

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

More
2 years 10 months ago #124087 by tpartner
tpartner replied the topic: Provide read only answer for one subquestion
...or just use the readonly property.

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

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!