Three text fields for one database entry for rails -
i have 1 text field date entry, trying split year, month , day 3 individual entries, seperated '/'. original text entry looks like:
<%= f.text_field :date, :placeholder => 'yyyy/mm/dd' %> i split 3 text_fields, , append them together, , put date entry in database. how can this?
you use textfields dates because needs 1 field. when having 3 different fields should consider using select instead. rails have date helper method date_select, somethink this:
<%= f.date_select :date %> this creates 1 select years, 1 months , 1 days. can read more on http://api.rubyonrails.org/classes/actionview/helpers/datehelper.html#method-i-date_select
Comments
Post a Comment