in reply to Retrieve Domain Username
I had to do this exact thing, too. My solution involves Javascript + ActiveX objects, which creates a dependency on Microsoft's Internet Explorer. If you don't want to impose that requirement, then this solution won't work for you. Perhaps something similar using a Java applet could be done.
The way it works is this: Say you have a form on a page with code like
<form action="submit.cgi" name="submit_form" id="submit_form"> <input type=submit name=submit value="Press to submit request"> <input type=hidden name=username value=""> </form>
What you'd like to do is set that hidden form field to contain the actual username, gotten from the user's environment. Add this snippet of Javascript code at the bottom (after the </body>):
<script language="JScript"> var netw = new ActiveXObject("WScript.Network"); document.forms["submit_form"].username.value = netw.UserName; </script>
That bit of Javascript code has to execute after the html which defines the form has already been "executed". Otherwise the form (forms["submit_form"]) won't exist.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Retrieve Domain Username
by earl_the_perl (Novice) on Oct 04, 2004 at 17:53 UTC | |
by jdporter (Paladin) on Oct 04, 2004 at 19:55 UTC | |
|
Re^2: Retrieve Domain Username
by jdporter (Paladin) on Oct 04, 2004 at 18:09 UTC |