Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fire event after client side script validation in asp.net?

Is there a way that I can execute a Javascript function after the client side validation occurs in asp.net?

I have a couple validation controls on a page and an input button with CausesValidation=true. The OnClientClick handler executes Javascript before the validation runs, but i want to run some functions afterwards.

Is this possible?

like image 409
Chris Conway Avatar asked Nov 10 '10 13:11

Chris Conway


1 Answers

The ASP.NET calls the WebForm_OnSubmit, thats runs the validation. After validation is ok, its continue and run the rest JavaScript functions that's found on onsubmit on the form.

So to execute a JavaScript after the side validation, just place it on the form tag.

For example:

<script>
  function CallMeAfterValidation()
  { 
    // here is the place to run your code
    return true;
  }
</script>

<form onsubmit="return CallMeAfterValidation();" runat="server" ...></form>
like image 172
Aristos Avatar answered Oct 06 '22 20:10

Aristos