Rails simple_form 在必填字段的星形下给出了点,有更好的方法来删除它们吗?
在我的许多项目中,我使用 simple_form 并且喜欢它。 然而,我发现一个非常奇怪的怪癖是,我在它为必填字段提供的 * 下面得到了 3 个小点。
我必须用以下方法来解决它:
= f.input :name, :label => '*', :required => false # Display purpose only (it is required)
这很混乱,因为该字段是必需的,所以这段代码看起来很难看。
对于看似常见的问题,是否有更好的解决方案?
In many of my projects I use simple_form and love it.
However one really strange quirk that I find is that I get 3 small dots underneath the * it supplies for required fields.
I have to get around it with:
= f.input :name, :label => '*', :required => false # Display purpose only (it is required)
Which is messy because the field is required, so this code looks ugly.
Is there a better fix for what seems like a common problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为它来自 CSS,如果您使用蓝图,“
abbr
和accronym
”标签具有border-bottom: 1px dotted black
样式。尝试将下一行添加到您的 css 文件中:
希望有帮助:)
I think it's from CSS, if you are useing blueprint, "
abbr
andaccronym
" tags have aborder-bottom: 1px dotted black
style.Try add to your css file the next line :
Wish helps :)
看起来像是 CSS 的东西。查看 CSS 上 abbr 标签的属性是什么。
It seems like CSS stuff. See what are the properties for abbr tags on your CSS.
简单形式添加一个带有边框底部的缩写。
您可以仅使用 css 删除 border-bottom ,但您还需要覆盖文本下划线属性(我认为来自默认导航器样式)
因此,这个小 css 块应该可以工作:
Simple form adds an abbr with a border-bottom.
You can remove the border-bottom just with css, but you also need to override the text underline property (which I think comes from default navigator styles)
So, this small css block should work :
我发现了另一个解决方案,以防其他人将来遇到这个问题。我回复了一个在 simple_form 上关闭的类似问题:
There's another solution that I found, in case anyone else comes across this question in the future. I responded to a similar issue that was closed on simple_form with this: