What I want to do is use DataAnnotation to identify validation on my model view. I also want to be able to call an action with Ajax.BeginForm or other feature, and that action returns JSON that would automatically update the form.
I have written code where I submit the form’s data using JQuery feature $.Ajax to the server. The action returns a model view that includes the errors and other info which is converted into JSON. But then on the client I had to write custom JavaScript to display the errors and such. This seems overly convoluted. It seems there should be a better way of doing this. Am I missing something
Is anyone aware of a better way of doing this, or know of any resource that can point me in the correct direction?
BarDev
No, you are not missing anything. If you return JSON you need to handle it on the client manually in order to update your GUI. An easier solution could be to return a partial view containing the form html containing all the validation errors.