Building multiple form tags on a single asp page
I am trying to be able to put a form tag within another form tag. Here is what the master page is structured as:
<form name="aspnetForm" method="post" action="test.aspx" onsubmit="javascript:return WebForm_OnSubmit()开发者_开发问答;" id="aspnetForm">
-----------CONTENT PLACE HOLDER--------------
</form>
Inside my content place holder i want to put another form:
<form id="test" action="test.ashx" method="post">
</form>
My jquery is trying to .prop this form's (id: #test) action attribute, but it can never find it because the outside form is not letting it. The outside form has a "runat="server"" but the inside one does not. Any ideas of how I can go about doing this?
I suggest you have a look at these to SO Questions and their answers:
- Can you nest html forms?
- How do you overcome the html form nesting limitation?
In a nutshell you shouldn't be nesting forms.
Are both forms in your DOM? The outer form can't "hide" the inner one from jQuery. $('form#test')
should still get it. Just make sure you do not reuse the same id in that page.
精彩评论