custom validations - where's the original value..

thinking this through maybe this is the problem

<td> <%= date_select 'enquiry', 'date_of_birth', :order => [:day, :month, :year], :start_year => 1950, :end_year => 2000, :include_blank => true %>

is the include blank the problem (maybe it's getting blanked on the re-render)?

bingo bob wrote:

thinking this through maybe this is the problem

<td> <%= date_select 'enquiry', 'date_of_birth', :order => [:day, :month, :year], :start_year => 1950, :end_year => 2000, :include_blank => true %>

is the include blank the problem (maybe it's getting blanked on the re-render)?

this looks like the problem to me - but how do i fix it?

I'd like to show a blank on the initial form but not when a validation fails and the form is shown again (the user should see the original selection?

No, the include_blank is not the problem I think. date_select automatically selects the value given in @enquiry.date_of_birth...

The problem must be somewhere else. Are you sure @enquiry is not reset? A mistake I used to make is to redirect from the create to the new action instead of directly rendering the new template from the create action when rerendering the form.

anyway, this is just a guess... I need to see how exactly you are rendering the form.