【发布时间】:2023-03-29 09:13:01
【问题描述】:
我正在尝试在我的页面中插入一个 simple_form 下拉列表,但在显示列表项时遇到了问题(两个电子邮件地址 - conatct@test.com 和 support@test.com)。当我单击下拉列表箭头时,它们根本不显示,因为它们不存在。
.reveal.doubt id="doubt-material-#{material.id}" data-reveal=true
button.close-button data-close=true aria-label="Close reveal" type="button"
span aria-hidden="true" ×
h5 #{t 'students.materials.index.questions.button'}
p #{t 'students.materials.index.questions.form_explanation'}
= simple_form_for [:student, trail, component, material, material_student, doubt], html: { id: "doubt" }, remote: true do |f|
= f.input :recipient, collection => %w(contact@test.com, support@test.com), label: "#{t 'students.materials.index.questions.form_send_email'}"
= f.input :question, as: :text, label: true, label: "#{t 'students.materials.index.questions.form_message'}" , input_html: { rows: "2" }
= f.submit "#{t 'students.materials.index.questions.form_send_button'}", class: 'button primary-button-active'
当我检查代码时,它似乎在工作,但我在任何地方都看不到电子邮件选项。
我添加的代码行是:
= f.input :recipient, collection: %w(contact@test.com, support@test.com), label: "#{t 'students.materials.index.questions.form_send_email'}"
这里有什么问题?
【问题讨论】:
-
去掉标签会怎样?看起来你可能会得到你想要的东西。 github.com/plataformatec/simple_form#collections 试试下面看看是否有帮助 = f.input :recipient, collection => %w(contact@test.com, support@test.com)
-
也不起作用。已经尝试过并查看了文档。我注意到 Select2 已“安装”在应用程序中。你认为这可能是个问题吗?
标签: ruby-on-rails jquery-select2 simple-form