我正在尝试使用我的rails应用程序设置formvalidation。我无法弄清楚为什么错误消息没有显示在工具提示中。我多次查看了formvalidation文档,看起来是正确的。我无法解决问题。我在vendor / assets / javascripts中有formValidation.min.js
和bootstrap.min.js
(formValidation版本)。我在供应商/资产/样式表中有formValidation.min.css
。
的application.js
//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//= require formValidation.min.js
//= require bootstrap.min.js
//= require bootstrap-sprockets
//= require bootstrap-select.min
//= require bootstrap-typeahead-rails
//= require turbolinks
//= require fancybox
//= require_tree .
$(document).ready(function() {
$('#custom-tag').formValidation({
framework: 'bootstrap',
err: {
container: 'tooltip'
},
icon: {
valid: null,
invalid: null,
validating: null
},
fields: {
tag: {
validators: {
stringLength: {
min: 3,
max: 10,
message: 'Must be between 3 and 10'
}
}
}
}
});
});
application.css.scss
/*
*= require bootstrap-select.min
*= require bootstrap-typeahead-rails
*= require formValidation.min.css
*= require fancybox
*/
的Gemfile
gem 'sass-rails', '~> 5.0.0.beta1'
gem 'coffee-rails', '~> 4.1.0'
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'font-awesome-sass'
gem 'uglifier', '>= 1.0.3'
gem 'bootstrap-typeahead-rails'
gem 'jquery-rails', '2.3.0'
gem 'fancybox2-rails', '~> 0.2.8'