How can I modify the input type of the Rails datetime_select helper?

前端 未结 2 491
死守一世寂寞
死守一世寂寞 2021-02-06 18:50

I am using the Rails helper datetime_select in one of my forms. I currently have a requirement to change the dropdowns for day, year,

2条回答
  •  迷失自我
    2021-02-06 19:31

    Why not roll your own, just name the input fields in the same exact way that the date picker helper does, and you get all the back-end benefits while rolling a custom front-end. Or use the :order to have your date picker give the month selection, and use some javascript magic for the other input.

    You can use a jquery datepicker and populate hidden fields with the same naming convention as the rails datepicker.

提交回复
热议问题