Welcome, Guest
Username: Password: Remember me

TOPIC: ... provide password-like obfuscation to text

... provide password-like obfuscation to text 3 years 3 months ago #63076

  • atiut
  • atiut's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 76
  • Thank you received: 2
  • Karma: 1
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 :(
The administrator has disabled public write access.

Re: ... provide password-like obfuscation to text 3 years 3 months ago #63079

  • jelo
  • jelo's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 470
  • Thank you received: 52
  • Karma: 16
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.
The administrator has disabled public write access.

Re: ... provide password-like obfuscation to text 3 years 3 months ago #63096

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4270
  • Thank you received: 803
  • Karma: 368
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: ... provide password-like obfuscation to text 3 years 2 months ago #63885

  • atiut
  • atiut's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 76
  • Thank you received: 2
  • Karma: 1
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:
The administrator has disabled public write access.

Re: ... provide password-like obfuscation to text 3 years 2 months ago #63903

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4270
  • Thank you received: 803
  • Karma: 368
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 3 years 2 months ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: atiut
Moderators: ITEd
Time to create page: 0.108 seconds
Donation Image