Disable all dates before today.

26 views
Skip to first unread message

rajeevkannav

unread,
Jan 13, 2011, 6:25:31 AM1/13/11
to calendar_date_select
I have this method in my application helper

def date_selector(field_name, value, opts = { })
if value.blank? and !opts[:no_eg_text]
value = Invitation::DATE_TEMPLATE_TEXT
style = 'color: #BBBBBB;'
else
value = (value.strftime("%m/%d/%Y %I:%M %p") rescue '') unless
value.is_a?(String)
style = ''
end

use_opts = {:time => true,
:class => 'fatinput',
:start_year => Time.now.year,
:before_close => 'catcalc(\'' + field_name + '\');',
:style => style }.merge(opts)

opts[:class] << " fieldWithErrors" if opts[:error]
calendar_date_select_tag(field_name, value, use_opts)
end

In Views this

<%= date_selector('object[end_time_local]',
@object.end_time_local,
:disabled => (@object.posted? and @object.recurring?),
:class => 'edit_time_fields',
:error => @object.date_errors?)%>


How can i disable all the dates before today ?
Thanks in advance

rajeevsharma86

unread,
Jan 13, 2011, 6:26:09 AM1/13/11
to calendar_date_select
i am one rails 2.3.2
--
Thanks:
Rajeev sharma


Reply all
Reply to author
Forward
0 new messages