sifupeter
May 19th 2008, 1:49 pm
I need to have a login page to send a user to 4 different urls with the same username and password. So I used 4 radio buttons that have urls in them like this:
<input type="radio" name="demo" onClick="form.action = 'https://fieldlab.website.com:8080/dashboard/dashboard.html?login=username@emailaddress.com&password=password&pageContext=salesManagersHomePage';"> So on “Submit”, the checked radio button with the hard coded url gets sent.
One problem with that is someone could view source and see the passwords, and also I have been told that the passwords will change so they can't be hardcoded into the radio button choice.
Now I want to have a username and password fields at the top, then 4 radio buttons with 4 urls without username and passwords in them yet, and then pass the username and password into the url when it gets submitted. How can I do this?
This is what I have so far, it's a combination of the first method and putting the username and password fields on top of that, so I'm sure it's totally wrong:
<html>
<head>
<title>Demo Log In</title>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
function get_radio_value()
{
for (var i=0; i < document.demologin.demo.length; i++)
{
if (document.demologin.demo[i].checked)
{
var rad_val = document.demologin.demo[i].value;
}
}
}
//-->
</SCRIPT>
<style>
body
{
background-color: e3e3e3;
font-family: Microsoft Sans Serif;
font-size: 10pt;
font-weight: bold;
color: black;
cursor: default;
}
h2 {margin: 70px 0px 0px 200px ; font-size: 21pt; color: #3a5173; font-weight: bold;}
p {margin: 10px 10px 10px 200px ; }
#login {
width:420px;
height: 350px;
border: 1px solid #000;
text-align: left;
background-image: url(loginbg.gif);
background-repeat: no-repeat;
z-index: 10;
margin: 50px auto;
padding: 0;
}
</style>
</head>
<body>
<form action="POST" method="post" name="demologin" target="_self">
<div id="login">
<h2>Demo Login</h2>
<p>Username: <input name="username" type="text" size="10" maxlength="20"></p>
<p>Password: <input name="password" type="text" size="10" maxlength="20"> </p>
<p><input name="demo" type="radio" onClick="form.action = 'http://www.yahoo.com';"> Production</p>
<p><input type="radio" name="demo" onClick="form.action = 'http://www.yahoo.com';"> FieldLab</p>
<p><input type="radio" name="demo" onClick="form.action = 'http://www.yahoo.com';"> FieldLab2</p>
<p><input type="radio" name="demo" onClick="form.action = 'https://fieldlab.website.com:8080/dashboard2/dashboard.html?login=username@emailaddress.com&password=password&pageContext=salesManagersHomePage';"> Demo</p>
<p> </p>
<p><input name="Submit" type="submit" value="Submit"></p>
</div>
</form>
<div>
</body>
</html>
<input type="radio" name="demo" onClick="form.action = 'https://fieldlab.website.com:8080/dashboard/dashboard.html?login=username@emailaddress.com&password=password&pageContext=salesManagersHomePage';"> So on “Submit”, the checked radio button with the hard coded url gets sent.
One problem with that is someone could view source and see the passwords, and also I have been told that the passwords will change so they can't be hardcoded into the radio button choice.
Now I want to have a username and password fields at the top, then 4 radio buttons with 4 urls without username and passwords in them yet, and then pass the username and password into the url when it gets submitted. How can I do this?
This is what I have so far, it's a combination of the first method and putting the username and password fields on top of that, so I'm sure it's totally wrong:
<html>
<head>
<title>Demo Log In</title>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
function get_radio_value()
{
for (var i=0; i < document.demologin.demo.length; i++)
{
if (document.demologin.demo[i].checked)
{
var rad_val = document.demologin.demo[i].value;
}
}
}
//-->
</SCRIPT>
<style>
body
{
background-color: e3e3e3;
font-family: Microsoft Sans Serif;
font-size: 10pt;
font-weight: bold;
color: black;
cursor: default;
}
h2 {margin: 70px 0px 0px 200px ; font-size: 21pt; color: #3a5173; font-weight: bold;}
p {margin: 10px 10px 10px 200px ; }
#login {
width:420px;
height: 350px;
border: 1px solid #000;
text-align: left;
background-image: url(loginbg.gif);
background-repeat: no-repeat;
z-index: 10;
margin: 50px auto;
padding: 0;
}
</style>
</head>
<body>
<form action="POST" method="post" name="demologin" target="_self">
<div id="login">
<h2>Demo Login</h2>
<p>Username: <input name="username" type="text" size="10" maxlength="20"></p>
<p>Password: <input name="password" type="text" size="10" maxlength="20"> </p>
<p><input name="demo" type="radio" onClick="form.action = 'http://www.yahoo.com';"> Production</p>
<p><input type="radio" name="demo" onClick="form.action = 'http://www.yahoo.com';"> FieldLab</p>
<p><input type="radio" name="demo" onClick="form.action = 'http://www.yahoo.com';"> FieldLab2</p>
<p><input type="radio" name="demo" onClick="form.action = 'https://fieldlab.website.com:8080/dashboard2/dashboard.html?login=username@emailaddress.com&password=password&pageContext=salesManagersHomePage';"> Demo</p>
<p> </p>
<p><input name="Submit" type="submit" value="Submit"></p>
</div>
</form>
<div>
</body>
</html>