Go Dropdownlist doesn ' t postback after page_clientvalidate ()

Source: Internet
Author: User

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>                
ShareImprove this answer

Go Dropdownlist doesn ' t postback after page_clientvalidate ()

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.