Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

need the syntax to input a user id as a variable

Posted on 2004-08-28
8
Medium Priority
?
147 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 600 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 600 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

705 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