Whether we can have a form inside another form?. Is there any problem with that.
Yes there is. It is wrong. It won't work because it is wrong. Most browsers will only see one form.
No. HTML explicitly forbids nested forms.
From the HTML 5 draft:
Content model: Flow content, but with no form element descendants.
From the HTML 4.01 Recommendation:
<!ELEMENT FORM - - (%block;|SCRIPT)+ -(FORM) -- interactive form -->
(Note the -(FORM) section).
Though you can have several <form>
elements in one HTML page, you cannot nest them.
The following post has your answers and alternative ways for redesign:
http://stackoverflow.com/questions/597596/how-do-you-overcome-the-html-form-nesting-limitation
Each form submits elements between form tags, and reset functions like...
If you try to nest them, each form and their related elements will have problem about submittimg the right data.
So it is not allowed. Depending what you wish to do, you can use if else tags to create diffrent form tags like:
if SomeData:
<form submit='a.php'>
else:
<form submit='b.php'>
{{form elements}}
</form>
It's not valid XHTML to have to have nested forms. However, you can use multiple submit buttons and use a serverside script to run different codes depending on which button the users has clicked.
That (nested forms) is a not a nice practice. You will not get what you expect to be, though HTML or server side scripts might not warn you doing that.
Why you want to use nested forms? Use multiple forms rather.
.. ...You can easily manipulate with multiple form objects using Javascript. Check this nice article to know more about how to access form objects in case of multiple forms.