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

Text field to read the computer user account name

hothousedesign
Registered: Jun 9 2010
Posts: 3

Is there a way using javascript to populate a text field with the PC computer user account name? So, someone can click on a radio button that will populate another text field with what their login name to their lap-top machine is.
This can be done in Excel using a Visual Basic command 'Environ'. Is there anything equivalent to do this for a pdf form in Livecycle?

Thanks.

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Yes, but you will need to have each user install an application level file that captures the 'identity' object. [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=18384]How to Capture UserID and Add to Form[/url]

George Kaiser

MarlaZ
Registered: Apr 28 2010
Posts: 112
Does this work if many users open and fill in different parts of the same form? Or does that get too complicated?

Marla

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Either method presented allows one to obtain one of the properties of the Acrobat/Reader identity object. You can do whatever you need to with that value. So if you have a text field for recording the identity of last user to modify that field. But you will have to write all of the necessary code to make sure you only update that field when a change to that field is made.

George Kaiser

hothousedesign
Registered: Jun 9 2010
Posts: 3
Thanks, gkaiseril, for your reply.
So, for version 7.0 or above, do I just need the document level codes, in Livecycle?
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
You can use either the function or the array. But because Adobe has made the 'identity' object only available during batch, console and application initialization. Initialization access is only available when Acrobat/Reader starts and processes the JS files within the application level folder.

From the Acrobat JS API Reference:

"[color=#FF0000]Note:[/color]The identity object properties are only accessible during batch, console and application initialization events to protect the privacy of the user. See “Privileged versus non-privileged context” on page 32 for details."

See [url=http://www.acrobatusers.com/tutorials/2006/folder_level_scripts]Entering Folder Level Scripts[/url] by Thom Parker for information about how to and where to create the necessary JS file. See [url=http://www.acrobatusers.com/tutorials/2006/javascript_console]The Acrobat JavaScript Console (Your best friend for developing Acrobat JavaScript)[/url] by Thom Parker for information about using the JavaScript Console in Acrobat. Note that Acrobat and Reader may have different paths to their locations.

Once you have the script installed in at the appropriate folder, then you will need shut down LiveCycle Designer, Acrobat and Reader, because the script will not take affect until the applications are restarted. Then you can call the function or use the created variable in LiveCycle Designer or Acrobat forms.

George Kaiser