Problem with multiple forms on one page

Posted by Jon on Stack Overflow See other posts from Stack Overflow or by Jon
Published on 2010-03-30T18:26:27Z Indexed on 2010/03/30 18:43 UTC
Read the original article Hit count: 322

Filed under:
|

I have two forms on a web page.

The first is not an actual form since this is a .NET based site. So instead I have the standard input fields, along with asp:Button PostBackURL="http:/www...". One of the fields is "email". That works fine.

Then I have an XSLT file with another form, and am using Javascript (via this.form.action, .method, etc) to post that form. Besides that it has the same fields as the form above.

The problem is that when someone submits the second form, the script at the PostBackURL returns an error because the "email" field appears empty. So it seems as though the form is submitting the "email" field form the top form instead of the current one.

I thought maybe the wrong form is being submitted, but if I remove the "email" field from the top form, and then submit the bottom one, it works fine.

Any ideas on how to fix this? Thanks.

© Stack Overflow or respective owner

Related posts about html

Related posts about forms