Reputation: 1
I want to change the error message, and that it does not work
$('form').validate();
messages: {
"form[name]": "test",
}
});
how fix?
I think the problem was not in the script only, but also in html.vot just can not understand what I'm doing wrong, it is necessary that the form "name" would pass validation.
this my html
<div class="form-group col-sm-12">
<%= f.label "Название" %>
<%= f.text_field :name, class: "form-control", required: :require %>
</div>
Upvotes: 0
Views: 337
Reputation: 756
Messages is a parameter of validate therefore your syntax is wrong.
Try:
$('form').validate({
messages: {
"form[name]": "test"
}
});
Further reading: http://jqueryvalidation.org/validate/
Upvotes: 0
Reputation: 388316
You have syntax errors in the script, also the name used is wrong so
$('form').validate({
messages: {
"event[name]": {
required: "test"
}
}
});
Demo: Fiddle
Upvotes: 1