Skip to content Skip to sidebar Skip to footer

Automatically Submitting An Asp.net Form With Javascript

I need to automatically log users in to an asp.net application who will be logging in from a php webpage. I thought this would be fairly simple but am having problems getting it to

Solution 1:

I managed to get it to work.

For some reason it didn't work with -

document.forms["form1"].submit();

But changing this to -

document.forms["form1"].elements["LoginBtn"].click();

Now lets me login.


Solution 2:

The reason it didn't work with submit is due to the fact you had not Input Type="Submit". An asp:button is not necessarily a "Submit" button, it is rendered as a button that performs an action. A Submit button performs a POST to the FORM'S ACTION PAGE. If no action page is defined (which is the case in your sample) nothing happens.


Post a Comment for "Automatically Submitting An Asp.net Form With Javascript"