These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Populating a text field with the username of viewer

jlaneville
Registered: Oct 7 2009
Posts: 5
Answered

Is there a way to populate a field with the users name automatically so that when they open it it shows their name in one of the fields?

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Yes, you need to use Acrobat JS's identity object. You will need to create an application folder JavaScript file to capture or establish a fucntion to get this data. See [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=18384]How to Capture UserID and Add to Form[/url] for more information.

George Kaiser

jlaneville
Registered: Oct 7 2009
Posts: 5
is there any way to do this within the xml for example? instead of having to run something outside of the pdf.

thanks
jake
UVSAR
Expert
Registered: Oct 29 2008
Posts: 1357
jlaneville wrote:
is there any way to do this within the xml for example? instead of having to run something outside of the pdf.
No - the Acrobat security model prevents the document from accessing anything that could be sensitive (like login names) unless the user takes intentional action to permit it, which they need to do by installing an external script.

If the PDF could do it without help, malicious scripts could silently pass the information to an external server.

It's assumed (rightly) that a PDF will only want the login name of a user in a closed network application, in which cases installing external scripts etc. can be done by the IT staff. There's no reason to collect usernames from the general public.
jlaneville
Registered: Oct 7 2009
Posts: 5
thank you for your help
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
The application level scripts to capture the elements of the 'identity' object work in both Acrobat Forms and LiveCycle Forms. But as noted these scripts need to be installed on the user's system, so either the user or a system administrator is reviewing them before installation or refusing to install them. The code to call or use the folder level script will need to be run as "JavaScirpt" in LiveCycle Designer.

Once this code is added any opened PDF can access this code as long as the variable of function names are known.

George Kaiser