0

I have a remote validator set up like this.

[Remote("ValidateField", "MyController", AdditionalFields = "Phone")]
MyProperty

It works with unobtrusive ajax and the like included just fine. However, when I change the field Phone (a field the validation depends on), I want it to rerun this remote validaiton.

I tried this: https://stackoverflow.com/a/5618380/386869 but I had no luck. I'm not running any jquery validate code on my own, I'm depending on the MVC attributes for validation (including the remote validation specified above), so maybe that's the problem? But I haven't need it until now...

Is it possible to rerun this remote validation using JavaScript?

Community
  • 1
  • 1
muttley91
  • 12,278
  • 33
  • 106
  • 160
  • You could handle the `.change()` event of the `Phone` control and in it, trigger the `.change()` of the `ValidateField` control –  Dec 09 '15 at 22:40
  • That's pretty clever. I ended up moving it into a separate custom validator, but I sort of want to try this anyway... – muttley91 Dec 10 '15 at 04:58

0 Answers0