More remote jQuery validation

In my previous post, I lament the troubles I had with remote validation. I got it working, but I am a stickler and a perfectionist, so I had to have more. I wanted unobtrusive validation and I wanted my error messages to show up properly. I also did not want to use the Remote annotation because I needed to use localization, which I have not been able to get working (it needs static strings).

I did some more banging my head on the keyboard, then I realized I could just emulate what was going on with the Remote annotation. So, I made a new FluentValidation rule and went about it. I realized soon I was missing someattributes, but when I tries to add attributes with dashes MVC balked. “WTF?” I thought. Thanks to the power of the googles, I am now no longer left wondering. I found this great post that gave me just what I needed. The gist is that when you define a rule, if you add additional validation parameters, they will be preceded by the original rule name. For example, I made a rule for data-remote, and I needed data-remote-url. If I added a ValidationParamter for “url”, it would append that to “data-remote-” and all would work as planned. HOORAY!