简体   繁体   English

删除Parsley-Rails错误消息,Rails 4

[英]Remove Parsley-Rails error messages, Rails 4

I am using fantastic gem "parsley-rails", it works just perfect for my application. 我正在使用奇妙的宝石“欧芹轨道”,它非常适合我的应用程序。

But now I am facing problem of removing those error messages, because they change form layout. 但是现在我面临着删除这些错误消息的问题,因为它们会更改表单布局。

My html looks like this : 我的html看起来像这样:

  <input data-parsley-minlength="3" data-show-errors="false" id="message_name" name="message[name]" placeholder="Kā Jūs sauc ?*" required="required" type="text" data-parsley-id="9402" class="parsley-error"><ul class="parsley-errors-list filled" id="parsley-id-9402"><li class="parsley-required">This value is required.</li></ul> 

My css: 我的CSS:

li.parsley-required {
  display:none !important;
}
ul.parsley-errors-list {
  display:none !important;
}
ul.parsley-error-list li {
  display:none !important;
}

This code hide all error messages on first validate click. 这段代码会在首次验证点击时隐藏所有错误消息。 But If I change input value error message is shown again. 但是,如果我更改输入值,则会再次显示错误消息。

I tried to look some Google results, but no valid resources. 我试图查看一些Google搜索结果,但没有有效的资源。

Any tip on this ? 有什么建议吗? Thanks in advance.. 提前致谢..

It's not clear what you're trying to do. 目前尚不清楚您要做什么。

Errors should get removed automatically by parsley . parsley应自动清除错误。

If you're doing something funky, call $form.parsley().validate() on your form, or call $field.parsley().reset() on . 如果您正在做一些时髦的事情,请在表单上调用$form.parsley().validate() ,或在上调用$field.parsley().reset()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM