Programmatically submitting a FORM with Javascript

In asp.net, it allows to create only one <FORM> tag. If you put more than one <FORM> tag it will generate an error. But some times we require multiple form tags and submit buttons. Because <FORM> tag in asp.net always submit the form to the page itself.

Here is some code in javascript, it will submit the form using javascript.

function submitform()
{
document.forms[0].action = "mynewaspxpage.aspx";
document.forms[0].submit();
}

This function will set the action to mynewaspxpage.aspx and submit the form. Normally this option required for submitting forms automatically.

This entry was posted in .Net, Javascript and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>