Solved

need the syntax to input a user id as a variable

Posted on 2004-08-28
8
140 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
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)

708 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

14 Experts available now in Live!

Get 1:1 Help Now