• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

need the syntax to input a user id as a variable

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
ssgtbond
Asked:
ssgtbond
  • 3
  • 2
2 Solutions
 
MogalManicCommented:
Something like this:

<html>
<head>
<title>Enter userID and click OK</title>
</head>
0
 
MogalManicCommented:
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
 
ssgtbondAuthor Commented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
MogalManicCommented:
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
 
dakydCommented:
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
 
ssgtbondAuthor Commented:
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now