Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automate login with javascript

Status
Not open for further replies.

PavelGur

Programmer
Sep 21, 2001
75
I'm trying to automate login to one of the sites I'm involved in. I found the example here in one of the previous threats and followed the advices.
First I saved the login page and entered values of id and password. Then I added after login form the following code:

<script type="text/javascript">
document.getElementById("LoginForm").submit();
</script>

Now when I load the page from my C drive it appears with ID and Password on the screen. However the page is not submitted and "log in" button is disabled. Even if I click on it or press Enter key nothing happens.

I looked in the page code and found the following related to the log in button:

<TD vAlign=bottom align=left><INPUT language=javascript class=submitbutton id=btnLogin onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " type=submit value="Log In" name=btnLogin></TD></TR></TBODY></TABLE></TD>

There is Page_ClientValidate function in the directory subordinate to the directory where page is saved. It looks like this:
function Page_ClientValidate() {
var i;
for (i = 0; i < Page_Validators.length; i++) {
ValidatorValidate(Page_Validators);
}
ValidatorUpdateIsValid();
ValidationSummaryOnSubmit();
Page_BlockSubmit = !Page_IsValid;
return Page_IsValid;
}
This function calls few other functions that are there as well.
I'm not sure what I should do to force page to be submitted. Should I try to disable the validatin functions?
Thanks in advance, PavelGur.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top