jquery-validation-rails icon indicating copy to clipboard operation
jquery-validation-rails copied to clipboard

Custom Validation Message

Open SamuelCabralCruz opened this issue 5 years ago • 0 comments

Hey, I was wondering if there were any way we can override the default validation message directly by passing arguments to the f.text_input tag in a .html.erb view in the context of a rails application.

      <div class="input-field">
        <%= f.label :email, t('registration.field.university_email') %>
        <%= f.text_field :email, class: 'required email',
                         pattern: univeristy_email_domains_to_regex %>
      </div>

Here is an example of the code I use. Along with this file, I also defined the custom messages into a corresponding javascript file, but I would prefer not to use this avenue (at least for the messages).

Thanks in advance

SamuelCabralCruz avatar May 23 '19 07:05 SamuelCabralCruz