Text box with text masked to user | XM Community
Skip to main content
Solved

Text box with text masked to user

  • February 26, 2019
  • 2 replies
  • 121 views

smdebb
Forum|alt.badge.img+3
I'm trying to create a textbox entry field and would like the text on the screen to be masked (with ** or ---- for example), but to have the actual text typed by the respondent recorded. If possible, it would be great to be able to have the respondent type this info, see the * but also have a way to toggle to "show" them the text prior to hitting submit or moving to the next question. Is this possible, and if so, can anyone supply the accompanying code?

Best answer by smdebb

Thanks for your help @Shashi! If I can inquire further.... I added the JS to the survey item, which is an open ended question (text box response). There is a toggle button for show/hide, but it doesn't seem to toggle between shown vs. hidden text. I am not even a novice in JS so I can't speak to what is wrong. Thanks!
View original

2 replies

  • 0 replies
  • February 27, 2019
Hello @smdebb , Here is the basic code for this: Paste the below code in the TextEntry question type js(OnReady) var that=this.questionId; jQuery("#"+this.questionId+" .InputText").attr("type","password"); var button="<input type='button' id='bid' value='show' / >"; jQuery(button).insertAfter(".InputText"); jQuery("#bid").on('click',function(){ if(jQuery(this).val()=="show"){jQuery(this).val("hide");jQuery("#"+that+" .InputText").attr("type","text");} else{jQuery(this).val("show");jQuery("#"+that+" .InputText").attr("type","password");} });

smdebb
Forum|alt.badge.img+3
  • Author
  • 1 reply
  • Answer
  • February 27, 2019
Thanks for your help @Shashi! If I can inquire further.... I added the JS to the survey item, which is an open ended question (text box response). There is a toggle button for show/hide, but it doesn't seem to toggle between shown vs. hidden text. I am not even a novice in JS so I can't speak to what is wrong. Thanks!

Leave a Reply