Convert form to submit on load instead of clicking submit button?

N

Network-Man

I am trying to streamline a form that in itself streamlines logging into a
site. Is there a way to make a form submit "onload" without clicking a
submit button?


<p><form
action="https://hostname.domain.com/ui/status/index.php?&DashBoardID=1&DashB
oard=Standard%20Services" method="post" target="_blank"><br />
<input type="hidden" name="LoginEmail" value="(e-mail address removed)"><br />
<input type="hidden" name="LoginPassword" value="mycleartextpassword"><br />
<input type="submit" name="Authenticate" value="Login"><br />
<input type="hidden" name="Action" value="1" ><br />
</form></p>


Users want a a shortcut that when they open it it goes straight to the
destination page of their dashboard. It's *too much trouble* having to open
the page that has this form and click on the login button. Is there a way I
can pass the same information without using a form? Security isn't an issue.

TIA
 
T

Toby Inkster

Network-Man said:
I am trying to streamline a form that in itself streamlines logging into a
site. Is there a way to make a form submit "onload" without clicking a
submit button?

<form id="foo">
....
</form>
<script type="text/javascript">
function myfunc () {
var frm = document.getElementById("foo");
frm.submit();
}
window.onload = myfunc;
</script>
 
N

Network-Man

Toby,
It worked like a charm.
I knew it would have something to do an "onload" statement, but that's as
close as I could get.
Thanks.

-Joel
 
Joined
Apr 7, 2008
Messages
2
Reaction score
0
It redirects me to login page... only button works. Why?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<body onLoad="myfunc()">
<form action="http://cportal.webd.pl/login.php" method="post" target="_top" id="foo">
[...]
</body>
</form>
<script type="text/javascript">
function myfunc () {
var frm = document.getElementById("foo");
frm.submit();
}
</script>
 
Joined
Apr 7, 2008
Messages
2
Reaction score
0
It redirects me to login page... only button works. Why?

<body onLoad="myfunc()">
<form action="http://cportal.webd.pl/login.php" method="post" target="_top" id="foo">

+

<script type="text/javascript">
function myfunc () {
var frm = document.getElementById("foo");
frm.submit();
}
</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top