I have a .NET po开发者_运维知识库wered website, that has a sign-up box form already. I'm using the JQuery dialog to popup a window, on which I also have a form. That form will not submit using a standard submit button. Nothing happens.
I use the following Javascript to allow my main page signup form to work properly:
<input onclick="this.form.action='http://domain.com/post.tml';
this.form.method='post';this.form.enctype='multipart/form-data';this.form.submit();"
type="image" src="/images/ui/btn-getfreereport.gif" alt="Signup" />
I tried using the same code for this popup form, but when you click the submit button, it instead uses the above code for the form that's on the actual site.
How do I focus the Javascript to submit one form instead of the other? Or is there an easier way to get this form to be submitted?
Thank you.
Use jQuery to submit the form:
$('.submit-form-button').click(function(){
$("#myformID").submit();
});
Turns out I just needed to add tags to each form. Visual Studio.NET complains about this as an error, but everything seems to work fine, including this new popup form.
Include your form's name, in place of myform
:
document.myform.submit();
精彩评论