【发布时间】:2017-10-31 01:21:06
【问题描述】:
我的表单目前有一个这样的表单:
这个简单的表单代码非常简单(使用horizontal_form类):
<%= f.input :taxes %>
但是,在输入数据时,大多数情况下人们都知道他们的年税,但很少知道月税。所以我需要一些不同的用户体验,而不是让它们一直分开并记住,这就是我想出的。
我不确定如何使用 simple_form 实现这个 HTML,但是上面的屏幕是从这个 HTML 呈现的:
<div class="form-group row decimal optional calculator_taxes"><label class="col-sm-3 col-form-label control-label decimal optional" for="calculator_taxes">Taxes</label><div class="col-sm-5"><input class="form-control numeric decimal optional" type="number" step="any" value="0.0" name="calculator[taxes]" id="calculator_taxes"></div>
<div class="form-check form-check-inline">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1" value="Yearly">Yearly</label>
</div>
<div class="form-check form-check-inline">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2">Monthly</label>
</div></div>
如何将这 2 个带有无线电 <div class="form-check form-check-inline"> 的 div 以简单的形式添加到现有的输入 HTML 中?
【问题讨论】:
-
只是想知道这些问题与 ruby 甚至 ruby on rails 有什么关系?
-
@KickButtowski 我将问题读作“如何使用 ruby/simple_form 生成此 HTML
-
@KickButtowski 用 HTML 很容易解决这个问题。我在 ruby on rails 视图中使用 simple_form,完全不同的游戏
标签: html css ruby-on-rails ruby simple-form