Check out the LimeSurvey source code on GitHub!

... provide password-like obfuscation to text

More
5 years 7 months ago #63076 by atiut
Hi

I need to protect some info from passers-by by making it look like a passowrd: "*********************".

I guess it should be pretty easy with javascript, just that i do not know the first thing about it :(

Please Log in to join the conversation.

More
5 years 7 months ago #63079 by jelo

atiut wrote: Hi

I need to protect some info from passers-by by making it look like a passowrd: "*********************".

I guess it should be pretty easy with javascript, just that i do not know the first thing about it :(


Not sure what you mean: Answerboxes, where people typein their answers show be displaying *** instead of the text?

You can use jquery for that.

E.g.
www.danwellman.co.uk/better-password-fields-with-jquery/

Since Limesurvey is using javascript and jquery you might need to analyze the question specific javascript routine to hook them in.

Another Demo with jquery
taledo.com.au/projects/text2pass/

You need to try to manipulate the specific question style at runtime.

tpartner might can help you finding the easiest way.

Please Log in to join the conversation.

More
5 years 7 months ago #63096 by tpartner
You can't dynamically change an input type (text to password), so I think you'll need to hide the text inputs and insert password inputs after them. Values entered in the password inputs can be loaded into the hidden text inputs.

1) Set up your survey to use JavaScript .

2) Add the following script to the source of the the text question. Replace "QQ" with the text question ID .
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		passField(QQ);
 
		function passField(qID) {
 
			// Loop through the text inputs
			$('#question'+qID+' input.text').each(function(){
 
				// Hide text input
				$(this).hide();
 
				// Insert a password input
				$(this).after('<input type="password" maxlength="255" size="20" class="text password">')
 
			});
 
			// Listener on the password fields
			$('#question'+qID+' input.password').change(function(){
 
				// Load value int hidden text input
				$(this).siblings('input.text').val($(this).val());
 
			});
		}
 
	});
 
</script>

Cheers,
Tony Partner

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

Please Log in to join the conversation.

More
5 years 7 months ago #63885 by atiut
Thank you for the detailed response. Hiding the text alltogether works for me.

However the specific script seemed not to work. I have some javascript on the survey already and I have worked with SGQA.

I am attaching a dummy survey, maybe it can shed some light.
Attachments:

Please Log in to join the conversation.

More
5 years 7 months ago - 5 years 7 months ago #63903 by tpartner
Don't use the complete SGQA in the function call, you only need the question ID .

Change:
passField(53854X123X5716);

To:
passField(5716);

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 5 years 7 months ago by tpartner.
The following user(s) said Thank You: atiut

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form