Solved

need the syntax to input a user id as a variable

Posted on 2004-08-28
8
141 Views
Last Modified: 2011-09-20
Hi,

I have some code that will allow me to open a webdav folder on a remote server.  I an addition to the code to allow users to enter their user id.  That userid will then be pushed into the path for the webdav folder and open the website.  Here is the code:

<HTML>
<HEAD>
<STYLE>
A {behavior: url(#default#AnchorClick);}
</STYLE>
</HEAD>
<BODY onload="document.all.GoWebFolder.click()">
<A ID="GoWebFolder" HREF="http://12.34.56.78"
FOLDER="http://www.homedrive.net">
Opening Web Folder...
</A>
</BODY>
</HTML>

I would like to be able to prompt for a userid as a variable and then push that variable the end of "http://www.homedrive.net/userid".  Userid would be the user's id.  I realize this would be a piece of cake for you guys, but I'm not a programmer.  Any help would be appreciated.

thanks

John Bond
0
Comment
Question by:ssgtbond
  • 3
  • 2
8 Comments
 
LVL 21

Expert Comment

by:MogalManic
ID: 11924039
Something like this:

<html>
<head>
<title>Enter userID and click OK</title>
</head>
0
 
LVL 21

Accepted Solution

by:
MogalManic earned 150 total points
ID: 11924049
Sorry 2nd try:
<html>
  <head>
    <title>Enter userID and click OK</title>
    <script type='text/javascript'>
function submitID()
{
   login.action="http://www.homedrive.net/"+login.userID.value;
   return true;
}
    </script>
  </head>
  <body>
    <form name='login'>
      <input type='text' name='userID'> <input type='submit' name=
      'OK' value='OK'  onclick='submitID()'>
    </form>
  </body>
</html>
0
 

Author Comment

by:ssgtbond
ID: 11924115
You're on the right track, but it still has to be a webfolder or webdav login.  About the only thing I've seen that would work with it is the "folder = " line.  by the way, it's https, sorry my fault in case you tried to get to the web site.  Thanks for the quick response.  Any other ideas?

jb
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 21

Expert Comment

by:MogalManic
ID: 11924376
You should be able to change the URL to any valid URL and it should work.  

You can also add some validation on the function and return false if the user name does not conform to some pattern.
0
 
LVL 19

Assisted Solution

by:dakyd
dakyd earned 150 total points
ID: 11926118
Is this more like what you want?  It uses a bit of javascript to show a userID prompt, instead of using a text field.  I did that because it looks like you want to go to this folder on loading the page.  So to keep that behavior intact, I used a prompt instead.  Hope that helps.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<style>
A {behavior: url(#default#AnchorClick);}
</style>
<script type="text/javascript">
window.onload = init;

function init()
{
  var theFolder = prompt("Please enter your user ID");
  var obj = document.getElementById("GoWebFolder");
  var pieces = obj.parentNode.innerHTML.split("folder=\"http://www.homedrive.net\"");
  obj.parentNode.innerHTML = pieces.join("folder=\"http://www.homedrive.net/" + theFolder + "\"");
  obj.click();
}
</script>
</head>
<body>
<a id="GoWebFolder" href="http://12.34.56.78"
folder="http://www.homedrive.net">
Opening Web Folder...
</a>
</body>
</html>
0
 

Author Comment

by:ssgtbond
ID: 12047747
I'll try it this weekend.  I'll give you the credit either way, and let you know.  thanks for the help.

jb
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now