开发者

rails check_box_tag value is NULL

开发者 https://www.devze.com 2022-12-23 18:10 出处:网络
I am not sure why I am having this problem, maybe I am using the check_box_tag incorrectly. I have a form that is used to send an email message. You are supposed to be able to choose one or more box

I am not sure why I am having this problem, maybe I am using the check_box_tag incorrectly.

I have a form that is used to send an email message. You are supposed to be able to choose one or more boxes that represent different groups of people.

<%= check_box_tag (:bcc_email, value = @spouses) %> <%= f.label :bcc_email, "Company Spouses" %><br />
<%= check_box_tag (:bcc_email, value = @soldiers) %> <%= f.label :bcc_email, "Company Soldiers" %><br />

The values are an array of email addresses. Those work fine, I have had them functioning as drop down menus for sometime.

When I look at the HTML page source the values are there, they are just 开发者_开发百科not being passed along with the create method.

Any ideas?


Ah of course I figure the problem out right as I post this. For anyone out there that makes really obvious mistakes like me:

Since I am using a check_box_tag, I never specified an object. Should look like this:

<%= check_box_tag ('message[bcc_email]', value = @spouses) %> <%= f.label :bcc_email, "Company Spouses" %><br />
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号