This article transferred from: Http://stackoverflow.com/questions/2083929/dropdownlist-doesnt-postback-after-page-clientvalidate
Update: I have just found the solution. The following function works (remove the else part): function confirmsubmit() { if (page_clientvalidate("Group1" ) ) { return window. Confirm("is sure to submit the form?") ); } }< /c10>
But I am wondering what it doesn ' t work if I add the else part. Question: I want to has a confirm dialog after user fills in the the the form. I set onclientclick= "Return Confirmsubmit ()" in the Submit button. functionConfirmsubmit() { if (page_clientvalidate ( "Group1" { return Windowconfirm ( "is you sure to submit the form?") } else { return false; } }
If page_clientvalidate ("Group1") returns false, the DropDownList doesn ' t cause postback after I first select the item, and The postback only occurs when I select the DropDownList second time. What ' s the problem? asp
ShareImprove this question |
Edited Jan at 4:50 |
Asked Jan ' at 4:37 Billy5,473about |
|
|
your validation rules are saying th E page is invalid and causing the postback to Stop...which are what they ' re supposed to do. Can you post the markup for your validators? One of them in Group1 are saying that it's not in a valid state. – nick craver♦ Span class= "Apple-converted-space" > jan "at 4:46 |
|
|
I have found the solution. –billy Jan at 4:56 |
Add a Comment |
2 Answersactiveoldestvotes
Up vote8down vote |
After Page_clientvalidate are called, the variable page_blocksubmit gets set to true and which blocks the autopost back. Page_blocksubmit is getting reset to False on the second click, for what reasons I still don ' t fully understand. I ' m looking to this, but I had a solution and I ' m under the gun so I'm rolling with it .... Just add below code in the code block which executes if Page is not valid. Page_BlockSubmit = false;
e.g. function Validatepage() {Flag= True; If (typeof (Page_clientvalidate) == ' function ') { Page_clientvalidate(); } If (!Page_isvalid) {Alert(' All the * marked is mandatory. '); flag = false; page_blocksubmit = false;} else {= Confirm ( ' is you sure we have filled The form completely? Click OK to confirm or CANCEL to the edit this form. ' } return Flag } /span>
|
Go Dropdownlist doesn ' t postback after page_clientvalidate ()