2

I have little strange situation. I want to submit form with java script on click with submit button or with form1.submit(); it is the same.

 <form id="form1" name="form1" runat="server" class="form-horizontal" action="frmSomeOtherPage.aspx" method="post">
 <input id="btnSubmit" name="btnSubmit" type="submit" value="submit" />

In order the folowing code to work fine:

form1.btnSubmit.click();

I must have on the page following line: (?!??!)

<asp:LinkButton ID='btnSubmitForm' runat='server' CssClass='btn-link' PostBackUrl='~/frmSomeOtherPage.aspx'></asp:LinkButton>

The interesting thing is that i didnt use anywhere btnSubmitForm! If the line with LinkButton was not there the form frmSomeOtherPage return error: Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page.............

If it is there LinkButton everything is just fine, although is nowhere used. I know that if I put <%@ Page EnableEventValidation="false" %> on frmSomeOtherPage everything will work.... But that is not solution... Just existence on the unused LinkButton solves problem but it is a little bit strange... even if we put PostBackUrl='~/frmNonExistingPage.aspx' on LinkButton still works correctly. And the LinkButton could be hidden also, still works well.

Any Idea?

0 Answers0