I'm am using ASP.NET MVC to create a page that posts to the Paypal sandbox. My form that posts to the Paypal site is nested inside a parent form. I am using Internet Explorer 7, and for some reason, the nested form posts to my local machine instead of the paypal site. If I add a copy of the same nested form directly after the first, the first one posts to localhost, and the second posts to where it is expected.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>
</title>
</head>
<body>
<form name="aspnetForm" method="post" action="" id="aspnetForm">
<!--First form posts locally-->
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="submit" value="Pay"/>
</form>
<!--Second identical form posts to the expected destination-->
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="submit" value="Pay"/>
</form>
</form>
Every form must be enclosed within a FORM element. There can be several forms in a single document, but the FORM element can't be nested.
You are not allowed to nest form elements. If the forms were separate (not nested) you can submit a different form using the form attribute on an input.
Using nested forms, we can create an array of objects within a single field and we can have an array of these fields. Hence, the nested form helps us manage large form groups and divides it into small groups. For example: A company decides to issue a form to collect data from users.
No, nested forms are forbidden. This means A FORM has a mandatory start tag, mandatory end tag and can contain anything in %block or SCRIPT, except other FORMs.
Nested forms are not vaild, and therefore their behavior is undefined. You just cannot nest them. Only one form can submit at a time, though you can have multiple, unnested forms on a page (only the one of the corresponding submit button will be submitted, though).
Looks like I used the ASP.NET master page template instead of the ASP.NET MVC one. The ASP.NET template includes a form tag which is what created this nested form page. Using the ASP.NET MVC template fixed my problem by removing the nested forms altogether.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With