Format date input on active scaffold form

Hi,

Being new to RoR, I have had difficulty finding information regarding date formats for active scaffold. I have a DATE field on the create form of one of my controllers. For this specific controller, I would like to capture the year only (i.e. %Y). I have already created a helper to display the %Y date on the view, but I cannot figure out how to do a similar change to the form to only request the user for the year.

Any thoughts on how this can be done?

David wrote:

Hi,

Being new to RoR, I have had difficulty finding information regarding date formats for active scaffold. I have a DATE field on the create form of one of my controllers. For this specific controller, I would like to capture the year only (i.e. %Y). I have already created a helper to display the %Y date on the view, but I cannot figure out how to do a similar change to the form to only request the user for the year.

Any thoughts on how this can be done?

You have to customize the field either in helper or in view. That is also called form/field overrides. See http://activescaffold.com/docs/form-overrides and http://activescaffold.com/docs/field-overrides for help.