Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to override the default jquery text for client validation in an MVC 3 project.

Obviously this looks like the right answer, but it's not working for me.

jQuery validation: change default error message

The error text specifically is also a bit different, it isn't

"This field is required."

It's "(DynamicFieldName) field is required." I want to change this, but I can't find it referenced anywhere. I've searched for all instances of required." in the entire project (as I assume that has to be defined client side somewhere for this to work, but maybe this text is being passed from the backend)

AH! I just found it, the validation text is being set as part of the html5 attribute validation things. Cool. Question solved.

I've checked the jQuery.validator.messages object, and my changes are being picked up.

Can anyone help!

share|improve this question

1 Answer 1

up vote 0 down vote accepted

The value is being set as part of the html5 validation attributes. Needs to be changed from serverside in the model.

[Required(ErrorMessage="Required"]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.