Problem with "date_select" form helper

Hi,
I am using "date_select" form helper to select the date.
My code is as follows:-

<%=date_select("post", "written_on", :prompt => { :day => 'Select day',
:month => 'Select month'}, :discard_year=>true)%>

It works.
But there is problem with the number of days for each month.
The days combobox has populated with the days from 1 to 31, but it is
not right in case of the month "Feb" as well as the months which has the
number of days are 30.

Is there a way to solve this problem? so that clicking on the month name
the corresponding days will change.

Thanks,
Tushar

You'll need to use a JavaScript function to do this. Once Rails renders the form elements, it doesn't interact with them again until the form is submitted, so it has no way to control the number of days. One thing you might want to look into is a JavaScript calendar popup (I'm fond of CalendarView myself, for Prototype) to replace these pickers entirely. You put the date in a regular text field, wire up the effect to open a calendar interface whenever that field gains focus, and the user sees a real calendar with days and months (and never more of the former than is possible, even unto Leap Year).

Walter