Why won't my form post back after validation?

前端 未结 1 1972
不知归路
不知归路 2020-12-15 12:15

I have an asp.net page with multiple validation summaries setup with ShowMessageBox=\"True\" and several validators. I have run into a situation where when vali

相关标签:
1条回答
  • 2020-12-15 12:54

    After working on this and making careful use of the debugger I finally found out that when you do validation the way described in the edit to the question a boolean is set on failure that blocks the next PostBack of the page from going through. I believe this is done when validation is being done automatically instead of explicitly as I'm doing here. Changing the javascript described above to look like this:

    function DoValidation() {
        if (!Page_ClientValidate('group1')) {
            Page_BlockSubmit = false;
            return false;
        }
        if (!Page_ClientValidate('group2')) {
            Page_BlockSubmit = false;
            return false;
        }
    
        return true;
    }
    

    Causes the problem to go away. Hopefully this will help the next person who makes the same mistake I did.

    0 讨论(0)
提交回复
热议问题