On my page I have toolbar which comes from Masterpage, and some input fields. All input fields are inside of tag form and toolbar outside tag form. Is it possible submit form 开发者_高级运维after pressing on button outside of form tag?
Please suggest, Alexander.
You can do it with JavaScript:
<input type="button" onclick="$('#someForm').submit();" />
The disadvantage, of course, is that it breaks without JavaScript.
I don't believe you can do what you ask without JavaScript, though.
Use the OnClick-event of the button to submit the form, f.e.:
<INPUT TYPE=BUTTON OnClick="document.formname.submit();" VALUE="Submit">
I know this is old but what I recently did to solve this problem is the following:
I didn't submit the form per se because of other issues but I called a sub in the VB code and just referenced the text box.
<asp:Button ID="SubmitButton"
runat="server"
class="TextButton"
onclick="SubmitButton_Click"
Text="Submit" />
then from there called a nice little sub in the behind file
Partial Public Class SurveyQuestions
Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
and then just a simple
Request("nameofcontrolhere")
and hey! Presto! It works without the use of a form, thereby allowing your button to be wherever you'd like.
精彩评论