Prevent editing of text field

Mehr
1 Monat 2 Wochen her #192650 von ch123
Hey. Again me with another question ;)
My survey has a short explanation text and on this basis first an open text field and then several single choice questions. Sometimes the single choice questions repeat a part of the open text question. That's why I want to prevent participants from editing their written text.
My ideas to do it:
1) Disable the previous button. Found this thread and it worked. But of course with it it's not possible to go back to other parts of the survey (as this text comprehension task is just a short part of the whole survey). So is it possible with this js-code to skip the page with the text field, but still go further back to the other parts?
2) Prevent editing the text field with grey out or something. So after validating the answer with pressing "next" it shouldn't be possible to do any changes...
Is it possible to do this?
Thanks in advance! :)

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners
Mehr
1 Monat 2 Wochen her #192655 von Joffm
Hi,
my idea is - as usual only with built-in functions - to store the entered text in a hidden question of the same type.

1. There is the question "Open1"
2. create a hidden question of the same type "Open2"
Now create two hidden equations:
3. Store the value of "Open1" into "Open2", BUT ONLY if "Open2" is still empty.
Equation: {Open2=if(is_empty(Open2),Open1,Open2)}
4. Restore "Open2" into "Open1"
Equation: {Open1=Open2}
So, if "Open1" was changed, the "old" value is entered again.

Example. You will see, the first entered text doesn't change.

Dateianhang:

Dateiname: limesurvey...7655.lss
Dateigröße:17 KB


Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Anhänge:
Folgende Benutzer bedankten sich: ch123

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #192663 von tpartner
My solution, as usual, includes JavaScript. :)

On page load, if the text element is not empty, disable it.

For a long-text question, something like this in the question source:

<script type="text/javascript" charset="utf-8">
 
	$(document).on('ready pjax:scriptcomplete',function(){
 
		if($.trim($('#question{QID} textarea:eq(0)').val()) != '') {
			$('#question{QID} textarea:eq(0)').prop('readonly', true);
		}
    });
</script>

For a short-text question, something like this in the question source:

<script type="text/javascript" charset="utf-8">
 
	$(document).on('ready pjax:scriptcomplete',function(){
 
		if($.trim($('#question{QID} input:text:eq(0)').val()) != '') {
			$('#question{QID} input:text:eq(0)').prop('readonly', true);
		}
    });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Folgende Benutzer bedankten sich: ch123

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #192666 von Joffm

My solution, as usual, includes JavaScript

:lol: :lol: :lol:

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #192675 von ch123
Both solutions are awesome - thanks a lot, Joffm & tpartner!
Now I have to decide which one works better for me :D

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha