开发者

Rails date select assigns month a value when blank

开发者 https://www.devze.com 2023-04-07 01:45 出处:网络
I am using Rails date_select as follows: <%= date_select :user, :birthday, {:start_year => Time.now.year, :end_year => 1910,:order => [:day,:month,:year], :prompt => { :day => \'day

I am using Rails date_select as follows:

<%= date_select :user, :birthday, {:start_year => Time.now.year, :end_year => 1910,:order => [:day,:month,:year], :prompt => { :day => 'day', :month => 'month', :year => 'year' }}, { :class => "default" } %>

When a user forgets to enter a value for the day or month and submit the form when the information is put into the model an error is generated. However the day an开发者_运维技巧d month fields also get assigned to 1. This results in the form showing 1 for the day field and January for the month field.

How can I stop this from happening?

0

精彩评论

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