【发布时间】:2016-09-08 00:44:49
【问题描述】:
如何将用户输入的表单数据添加到数据确认消息中?
= form_for(@booking, html: { class: "form-horizontal", role: "form" }) do |f|
.form-group.emails
= f.label :emails,'Any other emails to add?', class: "col-sm-2 control-label"
.col-sm-10
= f.text_field :emails, class: "form-control", placeholder: 'email address separated by a comma'
.form-group
.text-center
= f.submit "Send dates",
data: { confirm: "Are these email addresses correct? {add email addresses here..}" }, class: "btn btn-primary"
我想添加用户在电子邮件字段中输入的电子邮件。
所以如果用户输入地址
user@example.com
,确认消息将是
“这些电子邮件地址是否正确?user@example.com”
【问题讨论】:
-
当用户更改电子邮件字段中的任何内容时,您必须使用 jquery/javascript,只需根据此更新消息
标签: javascript ruby-on-rails forms ruby-on-rails-4