Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Unassigned: Unobtrusive validation doesn't work for Ajax response forms [1299]

$
0
0
The client-side-validation does not work for forms, included in a response of an _Ajax.ActionLink_ or _Ajax.BeginForm_, because the jQuery Validation does not parse the response HTML, which is appended to the body (_asyncOnSuccess()_ in _jquery.unobtrusive-ajax.js_).

A workaround is to reparse the whole document on every Ajax response:

```
$(document).ajaxSuccess(function() {
$.validator.unobtrusive.parse(document);
});
```

The attached MVC project reproduces this issue on the "Index"-page, and also includes the "SmallFormWithValidation" partial view directly (no ajax call) on the "About"-page to demonstrate the desired behavior of the client-side-validation.


Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>