user1660758
user1660758

Reputation: 23

auto submit won't run

edit: change of question

if my code is like this:

<form name="login" action="https://login.extremebb.net/login" method="post"

                >

                <input type="hidden" name="dst" value="/status.html" />

                    <label for="username"><b>Username: </b></label>

                    <input class="field" type="text" name="username" value="" size="23" />

                    <label for="password"><b>Password:</b></label>

                    <input class="field" type="password" name="password" size="23" />

                    <input type="submit" name="submit" value="Login" />

                <input type="hidden" name="redirect_to" value="/status.html"/>

                </form> 

what should i do to make it auto submit after page load or a set of time?

note: saved username and password in browser

Upvotes: 2

Views: 207

Answers (3)

DanCaveman
DanCaveman

Reputation: 685

you can click the submit button manually, but you need to give it an id to use getElementById. I am not sure, but I think the document.[name of element] is not cross browser compliant.

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
    </head>

<body onload="document.getElementById('submitButton').click();"  >
    <form id="subfrm"  name="subfrm" action="/Quantifi/" >
        <input type="hidden" name="dst" value="/success.html" />
        <label for="username"><b>Username: </b></label>
        <input class="field" type="text" name="username" value="" size="23" />
        <label for="password"><b>Password:</b></label>
        <input class="field" type="password" name="password" size="23" />
        <input type="submit" id="submitButton" name="submit" value="Login" />
        <input type="hidden" name="redirect_to" value="/Quantifi"/>
    </form>     
</body>
</html>

Edit: as others have mentioned, naming your submit button "submit" also causes problems. If you give the button and id/name of something else, the following would work on the onload event:

<body onload="document.getElementById('subfrm').submit();"  >

Upvotes: 0

Pilgerstorfer Franz
Pilgerstorfer Franz

Reputation: 8359

I think your error is at your submit button which has name="submit"! Changed it to ANYTHING_ELSE and worked!

<body onload="document.subfrm.submit();">
    <form name="subfrm"  action="../New%20folder%20(3)/success.html">
    <input type="hidden" name="dst" value="/success.html" />
    <label for="username">
        <b>Username: </b>
    </label>
    <input class="field" type="text" name="username" value="" size="23" />
    <label for="password">
        <b>Password:</b></label>
    <input class="field" type="password" name="password" size="23" />
    <input type="submit" name="ANYTHING_ELSE" value="Login" />
    <input type="hidden" name="redirect_to" value="../New%20folder%20(3)/success.html" />
    </form>
</body>

Upvotes: 1

rationalboss
rationalboss

Reputation: 5389

<html>
<body onload="document.getElementById('submit').click()">
    <form name="subfrm" action="../New%20folder%20(3)/success.html">
        <input type="hidden" name="dst" value="/success.html" />
        <label for="username"><b>Username: </b></label>
        <input class="field" type="text" name="username" value="" size="23" />
        <label for="password"><b>Password:</b></label>
        <input class="field" type="password" name="password" size="23" />
        <input type="submit" name="submit" value="Login" id="submit" />
        <input type="hidden" name="redirect_to" value="../New%20folder%20(3)/success.html"/>
    </form>
</body>
</html>

Upvotes: 1

Related Questions