Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
10 replies
Subscribers
7 subscribers
Views
3104 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Anybody know of a way to retrieve a client's IP address via a form? Maybe us
jordanp
over 11 years ago
Anybody know of a way to retrieve a client's IP address via a form? Maybe using JavaScript or something?...
OriginalPostID-91459
OriginalPostID-91459
Discussion posts and replies are publicly visible
0
padmanabhanv
over 11 years ago
What is your requirement? Is it to display the client IP on the form or use it downstream later?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jordanp
over 11 years ago
Ideally, we would like to store it in a process variable and use it downstream.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
shelzle
over 11 years ago
You can do this using an ActiveX component in Internet Explorer. We wanted to know the computer name and use this code
var network = new ActiveXObject('WScript.Network');
var cn = network.computerName;
window.FormAPI.setValue("computer_name", cn);
It might be necessary to modify some settings in IE.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jordanp
over 11 years ago
I'm not as familiar with ActiveX scripting.... where would you insert that code?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
shelzle
over 11 years ago
Please be aware that JavaScript is not supported on Tempo and Mobile enabled forms.
This code is simple JavaScript. In whole it looks like this and is put into the onload event of the form.
if (window.FormAPI.getValue("computer_name").id.length <=0){
if(window.ActiveXObject) {
var network = new ActiveXObject('WScript.Network');
var cn = network.computerName;
window.FormAPI.setValue("computer_name", cn);
}
}
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jordanp
over 11 years ago
I tried using your code to set a process variable to the value returned by computerName, but it doesn't seem to be working.... I've enabled the ActiveX scripting in IE, abd there are no errors with the process model, by the variable never gets assigned a value.... What could I be doing wrong? Is there a way to debug these scripts in Appian?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
shelzle
over 11 years ago
Do you have a field named "computer_name" in your form? Pressing F12 in IE opens the developer tools which should help you finding whats goind wrong.
For live JS development in Appian, add a paragraph (id: "js_code") and a yes/no field to your form. In the onclick event of the yes/no put something like
eval(window.FormAPI.getValue("js_code).id)
Start the process ond go to this form. This allows you to write some JS code in the paragraph and have it executed on click on the yes/no.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jordanp
over 11 years ago
The suggestion to create a paragraph field where javascript can be tested was very helpful, thank you. I am able to use this to verify that simple javascript commands are working (such as alert("Hello World!")). However, I am not able to get anything with ActiveX to work. I'm also unable to get any useful output from the IE debugger.....
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jordanp
over 11 years ago
No, I take that back, I am able to get some ActiveX commands to work, just not yours. I found a code sample online that would open Microsoft Word or Excel with some default text content. Pretty cool, actually. But whenever I try your code, nothing happens at all..... What am I doing wrong?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
shelzle
over 11 years ago
I just checked that. This code was developed a few years ago when the company was running IE7 or IE8. The process that contains it is not used anymore. I think either MS or our IT locked IE down so that this is not working anymore.
Sorry for that :-(
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel