问题描述
这个让我发疯。我有一个带有一组单选按钮的表单。当您单击单选按钮本身时,它们可以正常工作。单击标签也会选择,只是相应的单选按钮未显示为已选择。在这三个中,最右边的按钮正常工作。可以通过单击标签或按钮来选择它,并且单选按钮本身在任何一种情况下都显示为选中状态。然而,另外两个(在左边,在列表中的这个之前)有我描述的问题。同样,在这两个选项中,使用标签进行选择并在提交表单时发送正确的数据,只是没有选中的单选按钮来显示选择的内容。
我正在使用 simple_form。这是它们的生成位置:
<%= f.input :service_id,as: :radio_buttons,collection: account.services.where(interpretation: true),label_method: :description,include_hidden: false %>
我认为是一些 jQuery 代码引起的,我在按钮上放置了触发器,但没有结果。 有任何想法吗?我所有的其他单选按钮组都可以正常工作。
以下是违规页面上的结果 HTML,但在其他地方运行时效果很好:
<div class="form-group radio_buttons required order_service_id">
<label class="sr-only radio_buttons required control-label col-lg-2">
<abbr title="required">*</abbr> Service
</label>
<span class="radio">
<label for="order_service_id_4">
<input class="form-control radio_buttons required" type="radio" value="4" name="order[service_id]" id="order_service_id_4" />
On-Site Interpreters
</label>
</span>
<span class="radio">
<label for="order_service_id_5">
<input class="form-control radio_buttons required" type="radio" value="5" name="order[service_id]" id="order_service_id_5" />
Web Conference Interpreters
</label>
</span>
<span class="radio">
<label for="order_service_id_3">
<input class="form-control radio_buttons required" type="radio" value="3" name="order[service_id]" id="order_service_id_3" />
Over-the-Phone Interpreters
</label>
</span>
</div>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)