Expand my Community achievements bar.

How to assign IP address to Textfield

Avatar

Former Community Member
I want to assign the client's (person who is filling in the form) IP Address to a textfield called IPAddress. I know that I have to use a javascript command but I am not sure how to assign a value to the textfield.
4 Replies

Avatar

Former Community Member
I do not believe that you can access the IP address of the client programmatically, but assuming that you did to ssign a value to a field you would use the follow syntax:



fieldname.rawValue = "assigned value";



Note that the fieldname and method/properties are case sensitive.

Avatar

Level 3
Has anyone been able to access the IP address of the client by using JavaScript??

Avatar

Former Community Member
You cannot get access to that information from javascript insode of the PDF.

Avatar

Former Community Member
Most probably

PDFs "limited" javascript for designer doesn't allow access outside the PDF for security purposes.



Work Around:

Assuming your displaying your PDF on a website --> if you can, pass the IP address as a parameter to the PDF document.



Example:

http://localhost/yourPDF.pdf?ip=193.65.23.84



In your PDF document javascript:

event.target.URL

// cut your URL parameters up to get what you need



then: fieldname.rawValue = ipExtractedFromURL



Associated methods that will be needed to help you out.

decodeURI(decodeURIComponent(%20) will result in a blank space