# Auto populate Login ID in single line text in SharePoint Survey

I am using SharePoint 2013 and I have created a survey form which contains User ID related question. I would like to populate current User info in that field.

1. I tried by using [Me] as calculate the value in single line text item. It is working partially as I see some junk characters prefixed with Domain Name/Username. So I am unable to use it.
2. I try to Add Current User Filter and text filter in web parts, but it value displayed in text Filter, I am unable to save it in the survey response.

Kindly suggest how I can populate username in Survey text box?

Appreciate detailed explanation.

• Would you feel comfortable using JavaScript? If it were me, I would use JSLink and the _spPageContextInfo object to populate it. Otherwise, have you tried a person/group field instead of plain text? Why do you need plain text? – Kevin Stone May 31 '17 at 18:59
• Hi @Sive, welcome to SharePoint StackExchange :) , Could you please take a quick tour at sharepoint.stackexchange.com/tour to get informed badge :) Thank you for your contribution :) – Mohamed El-Qassas MVP May 31 '17 at 19:16

<input type="text" id="txtUserId" >
$(document).ready(function() { var userId = _spPageContextInfo.userId; var userEmail = _spPageContextInfo.userEmail; var userDisplayName = _spPageContextInfo.userDisplayName; var userLogin = _spPageContextInfo.userLoginName; //If you want to assign user id to textbox$("#txtUserId").val(userId);