---
title: "How to raise a callback when ASP.NET MVC client validation fails"  
description: "How to raise a callback when ASP.NET MVC client validation fails"  
author: "Ailsa Singh"  
published: 2017-05-05  
updated: 2017-05-06  
canonical: https://www.mindstick.com/forum/34291/how-to-raise-a-callback-when-asp-dot-net-mvc-client-validation-fails  
category: "asp.net"  
tags: ["asp.net", "asp.net mvc", "mvc"]  
reading_time: 1 minute  

---

# How to raise a callback when ASP.NET MVC client validation fails

Hi!!

I am using [ASP.NET MVC](https://www.mindstick.com/forum/155798/what-is-caching-in-asp-dot-net-mvc) 5 with jquery. I need to [handle](https://www.mindstick.com/articles/311004/suede-skillet-handle-cover) an [event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) when the [client](https://www.mindstick.com/articles/23198/3-steps-to-ensure-that-your-client-portal-is-impeccable) [side validation](https://www.mindstick.com/interview/33573/explain-client-and-server-side-validation) fails.

I tried this but got [failure](https://yourviews.mindstick.com/audio/1250/why-failure-is-the-first-step-to-growth):

```
$("#myform").bind("invalid-form.validate",
function () {alert('invalid!');
});
```

Thanks

## Replies

### Reply by Ailsa Singh

thanks Manish for your help...\
My problem is solved.

### Reply by Manish Kumar

Hi Ailsa,

According to your description, I suggest you could use valid function to check if current input value is valid or not after the input element lost focus.

I am providing to a script please check it May it helps you..

```
  $('input').focusout(function () {       
var currInput = this;       
if (!$(currInput).valid()) {            console.log("invalid!");       
}    });
```


---

Original Source: https://www.mindstick.com/forum/34291/how-to-raise-a-callback-when-asp-dot-net-mvc-client-validation-fails

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
