On Jan 4, 2011, at 1:00 AM, Tushar Gandhi wrote:
> 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.
>
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
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.