0

I have form that has several forms inside of it in asp.net mvc. The nested forms are using ajax helpers and are ajax forms.

The forms that are nested ALWAYS post to the original form's action, not their action.

Why? Why can't I have multiple forms on one page?

rsteckly
  • 1,952
  • 3
  • 23
  • 35

2 Answers2

5

You can have as many forms you like on a page, but you can't nest them.

It has nothing to do with ASP.NET or MVC, it's the HTML form tag that doesn't allow nesting. If you try to nest forms, the browser will ignore the inner form start tag.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
  • Hmm...okay, I didn't realize this. I've posted a follow up question here: http://stackoverflow.com/questions/4622034/when-a-submit-button-triggers-a-second-form-the-second-forms-submit-button-send. – rsteckly Jan 07 '11 at 02:32
-1

Even from the point of view of ASP.Net alone, only one form with a runat="server" attribute can be used within a web page. Otherwise, a run-time error will pop out halting the page creating process.

Ken D
  • 5,880
  • 2
  • 36
  • 58