Alex Rivera | Logout

Jquery Validation And Update Panel Together

Asked 2010-09-13T10:41:24.387
11

I m trying to use jquery validation plugin but my form is in update panel. So even after applying the validation on submit the form it validates and shows the required message for hardly 2 seconds and then submits the form.
What is the workaround for this?

I have tried this also.

<asp:UpdatePanel ID="AddUserPanel" runat="server"
             ChildrenAsTriggers="false"
             UpdateMode="Conditional">

But this also doesn't seem to help.

Edit
Report

1 Answer

0

Asp.net WebForms uses the __doPostback() function that submits your form.

This is what I would do:

  1. Check form submit execution to see whether things works as expected so validation happens first (which I'm pretty sure it does because you do get those messages up) and check the code of each individual part.

  2. If validation doesn't prevent default event execution (bubbling) by either returning false of calling preventDefault() or both, then it should be changed to work sufficiently with Asp.net WebForms.

  3. If everything seems to be fine on the validation front, you should change your __doPostback() function. It does sound hackish yes, but sometimes things like this have to be done. Copy existing code and add additional checking. Nothing to worry.

Also check this Stackoverflow question.

Oh hell. Just do a Google search on this and include stackoverflow results only: jQuery validation webforms site:stackoverflow.com

answered 2011-02-11T08:46:56.987

Your Answer