Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

protecting DEFAULT answer from being changed at runtime in a survey

More
8 years 8 months ago #122511 by kirti
Hi
Please let me know how to protect the editing the default answer of the question that is prefilled at runtime ?
I mean when the survey participant looks at the prefilled answer, he /she should not be able to edit it.

Please help
Thanks
Regards
Kirti
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 8 months ago #122522 by tpartner
You may want to use an equation type question for that.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
8 years 8 months ago #122524 by kirti
No Tony, thats not helping. I have to prefill the answer of the question "Name of the person being reviewed" where A is reviewing B so B's name is picked from Token:Attribute and that gets filled as default answer. But when I checked the short text box filled with answer, I could edit and insert another answer, which should NOT happen. That default answer should fade and should not be editable.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 8 months ago #122525 by DenisChenu
Hi,

Hide the question, than user don't see the question.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
8 years 8 months ago #122532 by kirti
question should be seen along with is default answer and requirement is editing of default answer should be prohibited
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 8 months ago #122534 by DenisChenu
Then : you don't need default answer, you need "Show something to user"

If you need to register information in the DB : use Equation question type
If you need to show : {TOKEN:ATTRIBUTE_1} in the question text or help.

You can show it "like" a input text:
Code:
<input type="texte" readonly="readonly" value="{TOKEN:ATTRIBUTE_1}" />

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
8 years 7 months ago #123284 by rola
why don't you disable the textbox ...
Code:
<script>
$(document).ready(function(){
 
$('#answer813917X1X68').attr('disabled','true');
 
$('#answer813917X1X68').val('{TOKEN:ATTRIBUTE_1}');
 
 
 
});
</script>
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago #123286 by tpartner
Disabling the input may prevent the data from being recorded. You should use .prop('readonly', true).

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: rola
The topic has been locked.
More
8 years 7 months ago #123302 by fvanderstarre
Question type "Text display"?
The topic has been locked.
More
8 years 7 months ago #123465 by rola
Thanks tpartner .... disabling the input prevent data from being recorded (i am using v 2.06+).
Code:
<script>
$(document).ready(function(){
 $('#answer813917X1X68').prop('readonly', true);
 $('#answer813917X1X68').val('{TOKEN:ATTRIBUTE_1}');
 });
</script>

fvanderstarre above example is for "Short free text" ... it can be applied for any other question type that renders input elements
The topic has been locked.
More
8 years 7 months ago #123475 by fvanderstarre
What I meant to say was: why not use question type text display? You don't have to worry about protecting from input there.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose